Sorting in a TreeView

  • Thread starter Thread starter steffen_home_92
  • Start date Start date
S

steffen_home_92

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
 
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?

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
 
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.

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
 
Back
Top