Treeview

Input Design

Sourcr Code

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;
namespace tree_view
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
TreeNode node = treeView1.SelectedNode;
MessageBox.Show(String.Format("you selected:{0}",node.Text));
}
private void Form1_Load(object sender, EventArgs e)
{
TreeNode treenode = new TreeNode("windows");
treeView1.Nodes.Add(treenode);
treenode= new TreeNode("linux");
treeView1.Nodes.Add(treenode);
TreeNode node2 = new TreeNode("c#");
TreeNode node3 = new TreeNode("vb.net");
TreeNode[] array=new TreeNode[]{node2,node3};
treenode = new TreeNode("dot net pearls", array);
treeView1.Nodes.Add(treenode);
}
}
}

Output Screen


No comments:

Post a Comment