A
AndrewDucker
If I set up a treeview with two node in it, and then click on the
second one, the AfterSelect fires _twice_ - once for the first node,
once for the second node.
Can anyone explain why it fires for the first node, and how I can make
it stop?
Cheers,
Andy D
Code to show it happening (presumes a button called button1, a treeview
called treeView1 and a textbox called textBox1):
private void button1_Click(object sender, System.EventArgs e)
{
TreeNode n = new TreeNode("Test1");
treeView1.Nodes.Add(n);
n = new TreeNode("Test2");
treeView1.Nodes.Add(n);
}
private void treeView1_AfterSelect(object sender,
System.Windows.Forms.TreeViewEventArgs e)
{
textBox1.Text += "/n" + e.Node.Text;
}
second one, the AfterSelect fires _twice_ - once for the first node,
once for the second node.
Can anyone explain why it fires for the first node, and how I can make
it stop?
Cheers,
Andy D
Code to show it happening (presumes a button called button1, a treeview
called treeView1 and a textbox called textBox1):
private void button1_Click(object sender, System.EventArgs e)
{
TreeNode n = new TreeNode("Test1");
treeView1.Nodes.Add(n);
n = new TreeNode("Test2");
treeView1.Nodes.Add(n);
}
private void treeView1_AfterSelect(object sender,
System.Windows.Forms.TreeViewEventArgs e)
{
textBox1.Text += "/n" + e.Node.Text;
}