all groups > dotnet windows forms > may 2006 >
You're in the

dotnet windows forms

group:

Sorting in a TreeView



Sorting in a TreeView steffen_home_92 NO[at]SPAM hotmail.com
5/31/2006 4:36:54 AM
dotnet windows forms: hi all,

when sorting in a tree view (.NET 2.0) is enabled, the control
automatically sorts an inserted node. When a user edits the label and
changes the name the edited node wont be sorted afterwards. I tried to
call the Sort() methode of the tree view control when the
AfterLabelEdit event is raised but nothing happens. Does anybody know a
solution?

Thanks,
Steffen
Re: Sorting in a TreeView Chris Jobson
6/2/2006 3:58:42 PM
[quoted text, click to view]

I had a different problem - when I called Sort() the application got stuck
in a loop repeatedly calling Sort. My solution (which is a bit nasty, but
works) is to enable a timer (with Interval set to 1ms) in the AfterLabelEdit
event, and to disable the timer and call Sort() in the timer's Tick event
handler.

Chris Jobson

Re: Sorting in a TreeView Steffen
6/4/2006 2:06:32 AM
[quoted text, click to view]

Yes, that works, thanks. If additional problems like that follow, my
program will once have more work arounds than code lines (and I destest
that!).

Steffen
AddThis Social Bookmark Button