I am a beginner learning vc# .net......
I want to implement a program in which by clicking on a particular node of the treeview it is copied to the listview using hash table...the nodes of the treeview may have hard coded values like of streams(cse,it,me...etc.).and child nodes like names of students. It will be a great help....waiting for a reply soon....
Loading
Len LPosted Mar 6, 2008, 5:34 PM
in the click event,
listView1.Items.Add(TreeView1.SelecetedNode.Text);
you might want to test tree node levels and node parent to ensure that your list view, list box or combo box gets the node value you want to add.
eg.
if(treeView1.SelectedNode.Level == 1 && treeView1.SelectedNode.Parent.Text == "Student")
listView1.Items.Add(TreeView1.SelecetedNode.Text);
You could also use a switch statement on the node level
eg
switch(treeView1.SelectedNode.Level)
{
case 1:
if(treeView1.SelectedNode.Parent.Text == "Student")
listView1.Items.Add(TreeView1.SelecetedNode.Text);
break;
case 2:
if(treeView1.SelectedNode.Parent.Text == "Jack")
comboBox1.Items.Add(TreeView1.SelecetedNode.Text);
break;
}
hope this helps.