469,576 Members | 1,834 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,576 developers. It's quick & easy.

When is a form finished loading?


Using VB 2005 Beta.

I have a form containing a DataGirdView. The cell enter, cell validating,
row enter, row validating events have a good bit of code that gets excuted
for each of these events. I have noticed that when the form loads, each of
these events run 3 times, before the form is ready for interaction with the
user. I would like to set a boolean variable to true when the form first
starts loading and change it's value when the form is ready to be used.
Hopefully I can test the value of this variable before each of the events
and speed my load time up a bit. Thing is I can not find the event where I
should change the variable. I have tried FormLoaded, Activated, and
gotFocus, but the 4 events mentioned earlier still run at least once after
each of these events. Can someone tell me what the last event that a form
runs before it is ready for user interaction?
Thanks,

Thomas

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
Nov 21 '05 #1
2 8626
th*****@msala.net wrote:
Using VB 2005 Beta.

I have a form containing a DataGirdView. The cell enter, cell validating,
row enter, row validating events have a good bit of code that gets excuted
for each of these events. I have noticed that when the form loads, each of
these events run 3 times, before the form is ready for interaction with the
user. I would like to set a boolean variable to true when the form first
starts loading and change it's value when the form is ready to be used.
Hopefully I can test the value of this variable before each of the events
and speed my load time up a bit. Thing is I can not find the event where I
should change the variable. I have tried FormLoaded, Activated, and
gotFocus, but the 4 events mentioned earlier still run at least once after
each of these events. Can someone tell me what the last event that a form
runs before it is ready for user interaction?
Thanks,

Thomas

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access


If you want to run the item once when the form is ready to display do this

In Form_Load Event
Addhandler Mybase.Activated, addressof Form_Activated

Sub Form_Activated(....)
RemoveHandler Mybase.Activated, addressof Form_Activated
'Do whatever you want to do once the form is ready show the first time

End Sub
Nov 21 '05 #2

Chris wrote:
th*****@msala.net wrote: If you want to run the item once when the form is ready to display do this

In Form_Load Event
Addhandler Mybase.Activated, addressof Form_Activated

Sub Form_Activated(....)
RemoveHandler Mybase.Activated, addressof Form_Activated
'Do whatever you want to do once the form is ready show the first time

End Sub


Firstly, in .Net 2.0, this is no longer necessary. A form has a new
event called "Shown" which is raised the first time a form is display
and never again.

Secondly, the OP wanted to make sure that none of his grid code
executed before the form was ready. The Load event should work fine
for this.

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Andreas Leue | last post: by
reply views Thread by the_kiddie98 | last post: by
4 posts views Thread by BerkshireGuy | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.