Suppress click at load???
-
I create a group of radio buttons so the user can select the database they want. When the user clicks one of the buttons, the event issues a detatch and re-attach to the proper database. The problem I am having is that during the form load I read the registry to find the current selection and then set the radio buttons showing which one has been checked by issuing a xyz.Checked = true; This then forces a click event which causes the db to detach/reattach. I only want the db to detach/reattach when the radio button is cliked by the user not during load. I get the same stuff using the CheckedChanged event and setting a bool first time pass doesn't seem to do the trick either. Thanks, Craig
-
I create a group of radio buttons so the user can select the database they want. When the user clicks one of the buttons, the event issues a detatch and re-attach to the proper database. The problem I am having is that during the form load I read the registry to find the current selection and then set the radio buttons showing which one has been checked by issuing a xyz.Checked = true; This then forces a click event which causes the db to detach/reattach. I only want the db to detach/reattach when the radio button is cliked by the user not during load. I get the same stuff using the CheckedChanged event and setting a bool first time pass doesn't seem to do the trick either. Thanks, Craig
The obvious solution is to use a state variable. While loading, this variable could be unset. Once the form is done loading (say, in the
OnLoad
override in yourForm
), set this variable. In your client event handler, determine if the variable is set. Only then do you execute your code.Microsoft MVP, Visual C# My Articles