Selasa, 15 Desember 2015

Create a TreeView from a Database in Windows Forms and C#

Introduction

A TreeView control provides a way to display information in a hierarchical structure using nodes.

Root Node (Parent Node)

The top level nodes in a TreeView is called the Root nodes.

Child nodes

The root nodes (also known as parent nodes) can have nodes that can be viewed when they are expanded. These nodes are called child nodes. The user can expand a root node by clicking the plus sign (+) button.

Table Definitions

Parent Nodes

CREATE TABLE [dbo].[MNUPARENT](
               [MAINMNU] [varchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
               [STATUS] [varchar](1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
               [MENUPARVAL] [int] IDENTITY(1,1) NOT NULL,
 CONSTRAINT [PK_MNUPARENT] PRIMARY KEY CLUSTERED
(
               [MENUPARVAL] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]Insert Sample Hierarchical Data
 
SET IDENTITY_INSERT MNUPARENT ON
GO

INSERT INTO MNUPARENT(MAINMNU, STATUS, MENUPARVAL) VALUES('Finanace','Y',1)
INSERT INTO MNUPARENT(MAINMNU, STATUS, MENUPARVAL) VALUES('Inventory','Y',2)

GO
SET IDENTITY_INSERT MNUPARENT OFF
GO

Child Nodes
 
CREATE TABLE [dbo].[MNUSUBMENU](
               [MENUPARVAL] [int] NOT NULL,
               [FRM_CODE] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
               [FRM_NAME] [varchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
               [MNUSUBMENU] [int] NOT NULL,
               [STATUS] [varchar](1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
PRIMARY KEY CLUSTERED
(
               [MNUSUBMENU] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
N [PRIMARY]

Sample Insert Statements
 
INSERT INTO MNUSUBMENU(MENUPARVAL,FRM_NAME,MNUSUBMENU,STATUS) VALUES(1,'Child Finance',10,'Y')
INSERT INTO MNUSUBMENU(MENUPARVAL,FRM_NAME,MNUSUBMENU,STATUS) VALUES(1,'Accounting',20,'Y')
INSERT INTO MNUSUBMENU(MENUPARVAL,FRM_NAME,MNUSUBMENU,STATUS) VALUES(20,'Audit',30,'Y')
INSERT INTO MNUSUBMENU(MENUPARVAL,FRM_NAME,MNUSUBMENU,STATUS) VALUES(30,'Acc. Standards',40,'Y')

Alternatively, you can have a single table to maintain this data of parent and child nodes.

Now let us start a new project and populate the TreeView.
  1. Create a new project and name it LoadTreeView.

    Image1.jpg
     
  2. Set the form's Name Property to FrmTreeView and its Text Property to Populate TreeView.
  3. Add a tree view control to the form and set its dock property to Left
  4. To configure the connection settings of the Data Source add an application configuration File

    From Project -> "Add" -> "New Item..."

    Image2.jpg
     
  5. Paste the code below into the App.config File:<?xml version="1.0" encoding="utf-8" ?><configuration>
      <
    connectionStrings>
        <
    add name ="ConnString" connectionString ="Data Source=yourServerName; User Id =yourUserName; Password =yourPwd;" providerName ="System.Data.SqlClient"/>  </connectionStrings></configuration>

  6. To access the connection string from code add a reference to System.Configuration and add the namespace using System.Configuration.

    Image3.jpg
     
  7. In the form's Load Event paste the following code:
     
    String connectionString;
    connectionString = ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString;
    conn = new SqlConnection(connectionString);
    String Sequel = "SELECT MAINMNU,MENUPARVAL,STATUS FROM MNUPARENT";
    SqlDataAdapter da = new SqlDataAdapter(Sequel, conn);
    DataTable dt = new DataTable();
    conn.Open();
    da.Fill(dt);

    foreach (DataRow dr in dt.Rows)
    {
        parentNode = treeView1.Nodes.Add(dr["MAINMNU"].ToString());
        PopulateTreeView(Convert.ToInt32(dr["MENUPARVAL"].ToString()), parentNode);
    }treeView1.ExpandAll();
  8. The Treeview is populated with its child nodes using the PopulateTreeView Method we have defined as in the following:
     
    private void PopulateTreeView(int parentId, TreeNode parentNode)
    {
        String Seqchildc = "SELECT MENUPARVAL,FRM_NAME,MNUSUBMENU FROM MNUSUBMENU WHERE MENUPARVAL=" + parentId + "";
        SqlDataAdapter dachildmnuc = new SqlDataAdapter(Seqchildc, conn);
        DataTable dtchildc = new DataTable();
        dachildmnuc.Fill(dtchildc);
        TreeNode childNode;
        foreach (DataRow dr in dtchildc.Rows)
        {
            if (parentNode == null)
                childNode = treeView1.Nodes.Add(dr["FRM_NAME"].ToString());
            else
                childNode = parentNode.Nodes.Add(dr["FRM_NAME"].ToString()); 
                PopulateTreeView(Convert.ToInt32(dr["MNUSUBMENU"].ToString()), childNode);
        }}
  9. Build and run the program that results in the output shown in the following:

    Image4.jpg
     
  10. Add the following piece of code to the treeview Double-Click Event:
     
    private void treeView1_DoubleClick(object sender, EventArgs e)
    {
        MessageBox.Show(treeView1.SelectedNode.FullPath.ToString());}
  11. When you double-click a node on the Treeview control a message is displayed with the fullpath to the node. Here I have clicked the Acc. Standards node.

    Image5.jpg

    Program
     
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Configuration;
    using System.Data.SqlClient;

    namespace LoadTreeView
    {
        public partial class FrmTreeView : Form
        {
            SqlConnection conn;
            TreeNode parentNode = null;
            public FrmTreeView()
            {
                InitializeComponent();
            }

            private void FrmTreeView_Load(object sender, EventArgs e)
            {
                String connectionString;
                connectionString = ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString;
                conn = new SqlConnection(connectionString);
                String Sequel = "SELECT MAINMNU,MENUPARVAL,STATUS FROM MNUPARENT";
                SqlDataAdapter da = new SqlDataAdapter(Sequel, conn);
                DataTable dt = new DataTable();
                conn.Open();
                da.Fill(dt);

                foreach (DataRow dr in dt.Rows)
                {
                    parentNode = treeView1.Nodes.Add(dr["MAINMNU"].ToString());
                    PopulateTreeView(Convert.ToInt32(dr["MENUPARVAL"].ToString()), parentNode);
                }

                treeView1.ExpandAll();
            }

            private void PopulateTreeView(int parentId, TreeNode parentNode)
            {
                String Seqchildc = "SELECT MENUPARVAL,FRM_NAME,MNUSUBMENU FROM MNUSUBMENU WHERE MENUPARVAL=" + parentId + "";
                SqlDataAdapter dachildmnuc = new SqlDataAdapter(Seqchildc, conn);
                DataTable dtchildc = new DataTable();
                dachildmnuc.Fill(dtchildc);
                TreeNode childNode;
                foreach (DataRow dr in dtchildc.Rows)
                {
                    if (parentNode == null)
                        childNode = treeView1.Nodes.Add(dr["FRM_NAME"].ToString());
                    else
                        childNode = parentNode.Nodes.Add(dr["FRM_NAME"].ToString());

                    PopulateTreeView(Convert.ToInt32(dr["MNUSUBMENU"].ToString()), childNode);
                }
            }

            private void treeView1_DoubleClick(object sender, EventArgs e)
            {
                MessageBox.Show(treeView1.SelectedNode.FullPath.ToString());
            }

        }
    }
Conclusion

In this article we have discussed how to populate a treeview dynamically in a C# application and display the entire path to the node on an event.


Source: http://www.c-sharpcorner.com/UploadFile/c5c6e2/populate-a-treeview-dynamically/

Jumat, 11 Desember 2015

Cara Atasi No Sound (Suara Hilang) Setelah Upgrade Windows 10

 Hasil gambar untuk no sound after windows 10 update
Upgrade Windows 10 yang di berikan secara gratis selama 1 tahun dari pihak Microsoft membuat mereka berbondong bondong untuk segera menginstallnya. Perlu pengorbanan waktu untuk dapat menikmati windows terbaru ini. Untuk ukuran file windows 10 yang berukuran sekiar 2.7 GB terhitung merupakan ukuran yang sangat besar. Proses upgrade ini sangat mudah, kita hanya tinggal ke menu windows update, dan pastikan semua update penting telah kamu install terutama bagi kamu pengguna windows 8.1 harus menginstall terlebih dahulu dua update penting yakni KB 3035583 dan KB2976978. Sehingga nanti di bagian bawah layar laptop akan muncul ikon  kecil muncul bernama Get Windows 10.
Proses upgrade terkadang ada beberapa permasalahan seperti yang saya alami ketika selesai melakukan proses upgrade ke Windows 10. Awalnya sangat khawatir, ketika memutar lagu dan video seluruh aplikasi dan media player yang berhubungan dengan sound dan video tidak dapat memutar lagu dan video. Selalu saja muncul peringatan aneh yang memaksa video tidak dapat di putar. 
Volume coba saya naikkan sampai ke level maksimal, namun tetap saja laptop tidak dapat mengeluarkan suara ketika saya main game. Sempat frustasi di buatnya, alhasil saya cari forum-forum mengenai permasalahan no sound di laptop saya. Ternyata bukan saya saja yang mengalami tapi memang ada banyak di luar sana. Singkat cerita akhirnya saya nemu jurusnya yakni cukup gampang dan ampuh. Berikut tahap-tahapnya.
1. Klik gambar sound yang terdapat pada kanan bawah layar laptopmu
2. Kemudian pilihlah menu Playback Device
3. Pilih Playback Device yang biasanya telah terpilih..lanjutkan double click sampai muncul Properties
4. Pilihlah tab Advance dan cobalah ubah bite rate ke yang lainnya sebagai contoh dari 24bit/44100 Hz  ke 24bit/192000Hz, ini semua tergantung pada konfigurasi speaker laptop kamu

5. Disana terdapat banyak pilihan setting cobalah satu persatu sembari mengecek suaranya
Melalui cara tersebut suara yang tadinya hilang kini kembali ke semula lagi. Untuk memutar lagu, video dan main game sudah dapat mengeluarkan suara dan berjalan lancar. Bagi kamu yang mengalami hal serupa ada baiknya kamu mencoba salah satu tips ini.
 
source: http://tiyogunners.blogspot.co.id/2015/09/cara-atasi-no-sound-suara-hilang.html

Rabu, 18 November 2015

Error A PHP Error was encountered Severity: Notice Message: Only variable references should be returned by reference Filename: core/Common.php Line Number: 257

Error
A PHP Error was encountered
Severity: Notice
Message: Only variable references should be returned by reference
Filename: core/Common.php
Line Number: 257
 
saya install CodeIgniter versi CodeIgniter_2.1.4
ketika di install maka ada error sbg berikut 
 
 
Untuk Solving problemnya adalah
1. C:\xampp\htdocs\CodeIgniter\system\core 
Edit filename: core/Common.php, line number: 257
 
2. 
Before
return $_config[0] =& $config; After
$_config[0] =& $config; return $_config[0];
 

Selasa, 17 November 2015

Cara Membuat Daftar Isi Pada Microsoft Office Word

Untuk versi microsoft officenya masih menggunakan yang versi 2007 karena di komputer belum terintall yang 2010 keatas. Tapi mungkin ga banyak perbedaan untuk cara membuat Daftar Isi pada microsoft office versi yang baru. OK, langsung aja.

Untuk membuat daftar isi menjadi lebih cepat dan rapi yang mesti kamu perhatikan sebelumnya adalah format huruf (Styles).


1. Dalam pembuatan Judul format huruf harus H1 atau Heading 1. Ini merupakan standar dalam penulisan judul, baik dalam pembuatan website atau eBook karena dalam pembuatan eBook harus diperhatikan agar bisa memenuhi SEO pada eBook. Lihat gambar dibawah ini untuk lebih jelas :

2. Sub Judul, format untuk sub judul harus berformat H2 atau Heading 2. Ini juga merupakan standar penulisan Sub Judul. Klik gambar untuk melihat jelas :


3. Kalau kamu memiliki sub judul lagi kami bisa menggunakan format H3 atau Heading 3. begitu jugaa seterusnya.


4. Setelah semua kewajiban yang mesti di penuhi telah dipenuhi, sekarang tinggal proses pembuatan Daftar isinya. Ini adalah inti postingan kali ini. Klik References >> Table of Contents >> Pilih Format sesuai kebutuhan kamu.


5. Kurang dari 5 detik daftar isi telah selesai dibuat.
Selamat mencoba..

Catatan : Untuk pengguna MS Word 2003, pada langkah nomor 4 perbedaannya adalah Klik Insert >> Reference >> Index and Tables lalu pilih format sesuai kebutuhan kamu.

OK, tutorial cara mudah membuat daftar ini telah selesai.
Semoga bermanfaat

Sumber : http://lughot.blogspot.com/2011/04/cara-membuat-daftar-isi-table-of.html

Tips Presentasi Powerpoint dengan membagi 2 Layar monitor (Multi layer)

Presentasi Dengan 2 Monitor - Pada saat melakukan sebuah presentasi powerpoint terkadang kita sering membagi-bagi materi presentasi kita menjadi beberapa file presentasi. Namun pada saat kita ingin membuka file lain di tengah tengah sesi presentasi kita maka kita pasti akan membuka windows explorer.

masalahnya jika ini dilakukan maka yang tampil di layar proyektor adalah tampilan Windows Explorer dan tentunya akan dilihat oleh semua hadirin yang menyaksikan presentasi kita. hal ini tentunya dapat menimbulkan kesan tidak profesional dan dapat membuat presentasi akan keliatan kacau.

Terus bagaimana Solusinya ????
Solusi dari masalah diatas adalah Tips Presentasi Powerpoint dengan membagi 2 Layar monitor (Multi layer). Dengan membutnya multi layer, kita bisa mengatur yang tampil dilayar proyektor hanyalah slide presentasi saja sedangkan di monitor laptop kita bisa membuka windows explorer, pemutar musik, membuka aplikasi baru, dll tanpa harus mengganggu slide presentasi. Bagaimana caranya...

Silahkan ikuti tips berikut :

1. Pastikan anda telah menyambungkan laptop dengan proyektor, lalu Setting display monitor atau tekan kombinasi tombol windows+P pada keyboard lalu pilih extend
2. Setelah pilihan extend di pilih, layar proyektor sudah mulai berubah.
3. Buka file power point yang akan di presentasikan
4. pilih pada ribbon Slide Show, pilih monitor 2 pada drop-down Show Presentation On:, lalu beri tanda centang pada Use Presenter View.


 Sekarang Proyektor hanya akan menampilkan slide presentasi saja. Contohnya seperti berikut :
Mudah bukan Tips Presentasi Powerpoint dengan membagi 2 Layar monitor (Multi layer) Jika bermanfaat jangan lupa di share ya...

Sumber : http://iptek-4u.blogspot.com/2012/04/tips-presentasi-dengan-membagi-2-layar.html#ixzz1tCEofmsU

Senin, 16 November 2015

Missing the Message Tracking Log Explorer in Exchange 2013? Not anymore…


Exchange 2013 has removed a number of user interfaces that existed in Exchange 2010, one of them being the Message Tracking toolbox utility:
image
In Exchange 2013 you can search for an individual messages in the Exchange Control Panel (https://servername/ecp) by selecting mail flow > delivery reports. But this tool requires you to specify the source mailbox and limits the answers somewhat, especially if your administrators mailbox is still on Exchange 2010 and you used https://servername/ecp/?exchclientver=15 to access Exchange 2013 ECP:
image
If you want to search across lots of mailboxes then your options are limited to Exchange Management Shell and using PowerShell. And with the considerably increase in internal monitoring emails that get sent around inside Exchange 2013, the logs are busy with all the Delivery Probe emails:
image
Get-MessageTrackingLog -Start “Nov 2 2012”
So to the rescue comes a PowerShell 2.0 feature called Out-GridView. To run a message tracking log in a user interface start in Exchange Management Shell with a simple Get-MessageTrackingLog cmdlet and output the results to Out-GridView
image
Get-MessageTrackingLog -ResultSize Unlimited -Start “Nov 2 2012” | Out-GridView
Now that you have the results in a grid you can add filtering, for example the below shows the tracking logs on my server once I filter out all the “probe” emails that are used by the Managed Availability feature to ensure that the server is operating correctly:
image
So although you need a bit of a command to start with, Get-MessageTrackingLog -ResultSize Unlimited -Start “Nov 2 2012” | Out-GridView, and need to include –ResultSize Unlimited to ensure you have all the results before you start filtering, this is a way to reduce some of the time to do tracking logs as the filtering and scrolling/resizing and ordering steps are managed for you which you do not get in the shell.
And of course, there are loads of things you can use Out-GridView for in Exchange 2013. Some of these include Get-Mailbox, Get-MailboxDatabase, Get-whatever you like that returns multiple rows of data.

5 thoughts on “Missing the Message Tracking Log Explorer in Exchange 2013? Not anymore…” 

 

Source : http://c7solutions.com/2012/11/missing-message-tracking-log-explorer-html

Senin, 02 November 2015

Cara Aktivasi Permanen Windows 8 dengan CMD

 


Cara Aktivasi Windows 8 via CMD |  Sobat , Kali ini saya berbagi Info Download Cara Aktivasi Windows 8 via CMD.  Berikut langkah-langkah cara Aktivasi Windows 8 Via CMD.


Aktivasi untuk Windows 8 Pro:
Pertama : Hubungkan dengan Internet
1) jalankan  CMD (sebagai  administrator)
2) Silahkan Ketik  :
slmgr.vbs -ipk NG4HW-VH26C-733KW-K6F98-J8CK4
slmgr -skms 147.134.1.42:1688
slmgr.vbs -ato
Aktivasi untuk Windows 8  Enterprise :
1) jalankan CMD (as administrator)
2) Ketiklah  :
slmgr.vbs -ipk 32JNW-9KQ84-P47T8-D8GGY-CWCK7
slmgr -skms 147.134.1.42:1688
slmgr.vbs -ato
 
soruce: http://tangkas24.blogspot.co.id/2013/01/cara-aktivasi-permanen-windows-8-dengan.html