Form Load Event

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the following code for showing a form:

dim frm as new myForm

frm.ShowDialog (The Form Load Event is fired then I hide the form using
Me.Hide when the X in the UR corner is clicked).

'Do something in code

frm.ShowDialog (The Form Load Event fires again)

Shouldn't the Form Load event fire only once when the form is first shown
and not again unless I do a form.close first?
......
 
Dennis said:
I have the following code for showing a form:

dim frm as new myForm

frm.ShowDialog (The Form Load Event is fired then I hide the form using
Me.Hide when the X in the UR corner is clicked).

'Do something in code

frm.ShowDialog (The Form Load Event fires again)

Shouldn't the Form Load event fire only once when the form is first shown
and not again unless I do a form.close first?

'Load' will be raised prior to showing the form, so it can be raised more
than once. If code should only be executed on time for each form instance,
add the code in the form's constructor directly after the call to
'InitializeComponent'.
 
If the load event is going to be fired each time I show the form, then what's
the difference between the Load Event and the Activated EVent...they both
seem to fire whenever I show the form? Thanks for help Herfried!
 
Dennis said:
If the load event is going to be fired each time I show the form, then
what's
the difference between the Load Event and the Activated EVent...they both
seem to fire whenever I show the form? Thanks for help Herfried!

The 'Activated' event will fire too then the form looses focus and is
reactivated later.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top