In C# Windows TreeView Control, I populate the Value from the DB. I have a Combobox with all the values same as Treeview node's Text. If i select a Particular text in the ComboBox corresponding Tree node should be selected. How to do this...Plz HelpSelect a particular node in the C# TreeView Control?
int tvIndex
foreach (TreeNode node in myTreeview.Nodes)
{
if (node.Value == text)
{
tvIndex = node.index;
}
this.myTreeView.SelectedNode = this.myTreeView.Nodes[tvIndex];
}
Use the same sort of code to search child nodes as well.Select a particular node in the C# TreeView Control?
1) if you are populating the combo box from the Treeview Text then the text you select from the combo box is that of the data provided in the Text.
2) If you are questioning an update of the values stored in The Treeview text after the values were updated into the combo box then you will need a else if statement to run the data set or another object to update the data input.
Thus, updating the data in the ComboBox with out having to do so manually through the Collection menu.
Basically you want to have some kind of code that will allow you to update your collection menu for the comboBox1 every-time you update the Treeview node's Text.
Subscribe to:
Post Comments (Atom)
TreeView node selection in C#.NET
ReplyDelete