Sorting in a TreeView

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
 
C

Chris Jobson

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
 
S

Steffen

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top