Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2006

Tip: Looking for answers? Try searching our database.

Form Loading Issue - VS.NET 2003

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sidprice@softtools.com - 01 Feb 2006 01:20 GMT
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.
Brian Patterson - 01 Feb 2006 04:19 GMT
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

> Hello,
>
[quoted text clipped - 9 lines]
> Thanks,
> Sid.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.