I am using the Windows Forms TreeView
control.
The way i have it hooked up is as followed (simplified):
TreeView treeView = new TreeView();
treeView.BeforeSelect += beforeSelect;
private void beforeSelect(sender, args)
{
MessageBox.Show("Some msg");
// more code
}
In certain scenarios, the call to MessageBox.Show triggers another raising of the BeforeSelect event, which triggers another, and another, ...
It seems this event is raised PER ITEM in the treeview (i have counted the number of times it is raised).
I have searched all over the internet on more information for why this could occur.
One thing i've found was that TreeView will automatically select the first node when gaining focus. This does not explain however why the event is fired as the number of treenode items in the tree.
Any help would be appreciated on this. I am considering raising a Microsoft Connect bug for this, as it seems like a very weird behavior that is not consistent with how i think the control should work.