Hello,

I have a dialog in my VB.NET application that has some controls for
configuration and an "Apply" button. The design calls for the Apply button
to be enabled only after the user has made changes to the settings. To do
this the change events for each control are used and the Apply button
enabled when any control raises a change event. The problem is that when the
form loads and default values are output the controls (correctly) fire
change events. Is there a mechanism to get around this, so that only user
changes enable the Apply button?

Thanks,
Sid.

Re: Form Loading Issue - VS.NET 2003 by Brian

Brian
Tue Jan 31 22:19:32 CST 2006

Previously I have overcome this problem by doing the following:
1) Store all settings in a "settings" class.
2) Create a private bool member within the form to track the state.
3) Pass the settings class to the form.
4) Once the settings are passed in - either on the constructor or in the
form load - propulate all controls with the information. Set the bool
member to "true" indicating that your population of settings has been
completed.
5) In the on change event of your controls (and I assume you share a common
change event among all the control) - first check the member variable to
ensure it is set to "true" before enabling the Apply button. If the member
is still "false" - then do nothing.

I've also heard of people putting all there event declarations into a single
method and then not calling the method until all the data on the form has
initially been populated.

Brian Patterson
http://dotnet.redeyepos.com
http://brian.redeyepos.com

<sidprice@softtools.com> wrote in message
news:O$H6s2sJGHA.1132@TK2MSFTNGP10.phx.gbl...
> Hello,
>
> I have a dialog in my VB.NET application that has some controls for
> configuration and an "Apply" button. The design calls for the Apply button
> to be enabled only after the user has made changes to the settings. To do
> this the change events for each control are used and the Apply button
> enabled when any control raises a change event. The problem is that when
> the form loads and default values are output the controls (correctly) fire
> change events. Is there a mechanism to get around this, so that only user
> changes enable the Apply button?
>
> Thanks,
> Sid.
>
>