Form Load Runs Events
-
I have a windows application with lots of controls that are set with initial values. When the form loads, execution occurs about a dozen times. How can I stop this execution on form load? I am using VS 2010. Bobby
-
I have a windows application with lots of controls that are set with initial values. When the form loads, execution occurs about a dozen times. How can I stop this execution on form load? I am using VS 2010. Bobby
Define "execution".
The difficult we do right away... ...the impossible takes slightly longer.
-
Define "execution".
The difficult we do right away... ...the impossible takes slightly longer.
Richard, I have a sub in the form that does all the calculations for the form. Many of the controls will trigger it. I added a message box in the execution of this sub and it pops up a dozen times before I see the form. It's like all the controls change events are firing during the form load. Bobby
-
Richard, I have a sub in the form that does all the calculations for the form. Many of the controls will trigger it. I added a message box in the execution of this sub and it pops up a dozen times before I see the form. It's like all the controls change events are firing during the form load. Bobby
Create a module-level Boolean flag that keeps track of whether the form is loading for the first time. Before you set the controls to their initial values, set the flag to true. When you are done setting the controls to their initial values, set the flag to false. In your calculation sub, check the value of the flag for false before performing the calculations.
The difficult we do right away... ...the impossible takes slightly longer.
-
Create a module-level Boolean flag that keeps track of whether the form is loading for the first time. Before you set the controls to their initial values, set the flag to true. When you are done setting the controls to their initial values, set the flag to false. In your calculation sub, check the value of the flag for false before performing the calculations.
The difficult we do right away... ...the impossible takes slightly longer.
Thank you for your help. Now I can apply the fix to a number of other applications. Bobby