Windows Develop Bookmark and Share   
 index > Windows Forms General > TreeView event bug
 

TreeView event bug

I've come across what I think is a bug in with the TreeView control and how
the AfterSelect event appears to take control of the event queue by placing
itself higher than other events.

Situation:
1.  Focus is currently on TextBox control.
2.  User clicks on a different (than the currently selected node) child node
in TreeView.

The following events occur in this order:

TreeView_AfterSelect
TextBox_Leave

I would expect the order to be reversed because one must LEAVE the textbox
before one can trigger an TreeView event.

I tested my findings with other controls (ListBox, ComboBox, Buttons, etc.)
and in those cases the event sequence is:

TextBox_Leave
OtherControls_Click (or appropriate event for that control)

It appears that TreeView is the ONLY control that seems able to somehow
change the event sequence. (CauseValidation is set to True on all controls
which should not have any significance with the TextBox_Leave, but thought I
just add that info).  I also changed the TabOrder but that had no affect.

Can anyone else confirm this problem?  or Feature? ;)

To reproduce just create a Form, add a TreeView, add a TextBox, populate
TreeView with some nodes & child nodes.  Place a*space
space*point in the
TreeView_AfterSelect and place another*space
space*point in the TextBox_Leave.
Run the application, place your cursor in the TextBox (with Mouse), then
click on a child node (different that current) in the TreeView.

Thanks,

Mike
MigrationUser 1  Tuesday, February 01, 2005 6:01 AM
I'm using framework v1.1 SP1 and Textbox.Leave fires first every time.
MigrationUser 1  Tuesday, February 01, 2005 11:39 AM
I cannot reproduce this behavior in MDE03 v7.1.3088/ .NET Framework 1.1 v1.1.4322 SP1

It must be something in your development environment.
MigrationUser 1  Tuesday, February 01, 2005 1:28 PM
Thanks for checking, I have framework version 1.1.4322 installed with SP1.

Could it be something to do with the fact that I'm using Visual Studio .Net Standard (VB.Net) version 7.0.9466 with Hotfix (KB830348) ?

Thanks,

Mike
MigrationUser 1  Wednesday, February 02, 2005 4:24 AM
Thanks for that please see my previous reply.

Mike
MigrationUser 1  Wednesday, February 02, 2005 4:25 AM
http://support.microsoft.com/?kbid=824996
MigrationUser 1  Tuesday, February 15, 2005 12:27 PM
Mike, I was able reproduce your problem.  I have a similar problem with a DataGrid (rather than a TextBox) and a TreeView.  The TreeView events fire before any of the DataGrid events.  I'll see if SP1 makes a difference.
MigrationUser 1  Wednesday, March 09, 2005 9:36 PM

You can use google to search for other answers

Custom Search

More Threads

• Hoping for a clean uniform grey background on winforms application startup...
• HOWTO: Flag Property Designer for components/controls
• Question!!!Who can give me a hand -II
• Web Browser Control question!
• ReadOnly TextBox
• How do i load a ocx file in C# windows forms - 2005
• passing value between windows forms
• Mdi Parent & child
• Get a certain text from a window
• Securing files