Home All Groups Group Topic Archive Search About

Tracking changes made to form...

Author
15 Mar 2006 3:50 PM
YYZ
Just wondering if there is a good way to do this that won't take me
forever and a day.

My form has many textboxes and comboboxes and radio buttons and
checkboxes on it.  I want to know if a user changes a value on any of
those things...and if so, when they close the form, if they haven't
saved, prompt them to do so.

I can go into every textbox's TextChanged event and add this code:
bChanges = True - however, this will take a LONG time...is there some
neat special new .Net way of tracking if any data has changed on the
form?  Or do I have to add that line of code to every control?

Matt

Author
15 Mar 2006 4:19 PM
SStory
Well,

Not sure about a great way, but seems you could loop through all textbox
controls and AddHandler to add one handler to them all for TextChanged.

That way you'd have one routine that handles text changes for all textboxes.

HTH,

Shane
Show quoteHide quote
"YYZ" <matt.da***@gmail.com> wrote in message
news:1142437826.093326.98840@e56g2000cwe.googlegroups.com...
> Just wondering if there is a good way to do this that won't take me
> forever and a day.
>
> My form has many textboxes and comboboxes and radio buttons and
> checkboxes on it.  I want to know if a user changes a value on any of
> those things...and if so, when they close the form, if they haven't
> saved, prompt them to do so.
>
> I can go into every textbox's TextChanged event and add this code:
> bChanges = True - however, this will take a LONG time...is there some
> neat special new .Net way of tracking if any data has changed on the
> form?  Or do I have to add that line of code to every control?
>
> Matt
>
Author
15 Mar 2006 5:12 PM
YYZ
Great idea -- thanks for that.  One quick question...will there be any
unintended consequences if I already HAVE a handler for a textbox, and
then I add another for the changes thing?

Matt
Author
15 Mar 2006 5:46 PM
Armin Zingler
"YYZ" <matt.da***@gmail.com> schrieb
> Great idea -- thanks for that.  One quick question...will there be
> any unintended consequences if I already HAVE a handler for a
> textbox, and then I add another for the changes thing?

No.


Armin
Author
15 Mar 2006 6:59 PM
YYZ
> > Great idea -- thanks for that.  One quick question...will there be
> > any unintended consequences if I already HAVE a handler for a
> > textbox, and then I add another for the changes thing?
>
> No.

Great!  That sounds like a great solution, then.  Now I'll do some time
testing on how it affects the performace to dynamically add those
handlers at run time.

Matt