Tracking changes made to form...

Y

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
 
S

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
 
Y

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
 
A

Armin Zingler

YYZ said:
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
 
Y

YYZ

Great idea -- thanks for that. One quick question...will there be

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
 

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