Check to see if the Form is Opening...

Windsailor

Well-known member
Joined
Aug 2, 2006
Messages
45
Programming Experience
1-3
Hi all,

How do I check to see if the form is loading at the time an event fires?

For instance, lets say I have code on the combobox1_SelectedValueChanged event I want to fire ONLY after the form and all of its components have fully loaded and gone through the Initialize component method for that form...

How do I set a conditional to check for that?
 
in VS2005 there's the Shown event too, which is fired after the form is shown for the first time (right after the Load event and the painting of the form)

Also the Shown is only fired once, if the form loses focus and then gets focus back it's the Activated event that's fired each time.
 
I am missing your guys' points here... sorry.

I want to keep the code in the _SelectedValueChanged event in the combobox so it will fire correctly after the form is initialized and loaded... I still want to trap that event so I don't want to move that code anywhere else.

What I am finding is that the _SelectedValueChanged event is also firing when it is going through the initialization sequence for the form. That part I want to stop.

I suppose I could assign a local variable and have it changed after the form goes through its Load_Event but that wasn't originally what I was looking for...

Edit---
I guess to put it another way... how do I find out if the Form_Load event had already been fired?
 
I think thats what I will do... assign the variable a value at the end of the Form_Load (or _Shown) event and check to see if that value is there before I go on...

Thanks guys... :)
 
Back
Top