Wednesday, February 9, 2011

validating and adjusting a treeview label

Hi,

I've got a treeview control, and have caught its after-label-edit event. I want to be able to validate the user's input and adjust it - if for instance it's too long - but I only seem able to cancel the new value, not change it. Any ideas?

I don't want to have to open a new form, the user might be renaming a range of these and it shouldn't be too cumbersome.

Cheers.

  • Can't you get the node being edited from the EventArgs, and manually set its text? If this causes the AfterLabelEdit to be fired again, then you should add a flag to exit it if it comes from a manual edit.

    Fry : More or less, that's how I deal with most user editable entries in the gui that need to be validated

0 comments:

Post a Comment