Looking for an event that fires only once on startup

L

LDD

After upgrading sucessfully to VB.Net... WooHoo!!! It was a slow process,
but in the end it seemed to have worked out well.

I've noticed the the form_active (VB6) is no longer available. There is the
Form_Activated available.

I have built a work around, but everytime the main form for the app is
clicked, the form_activated event fires.

Is there the equivalent to the form_active in VB6. Where the code only
executed on startup? I was hoping to find like a form_init or something
along those lines.

Does anyone know if there is an event that fires only on the intital
startup?

thanks folks

LDD
 
H

Herfried K. Wagner [MVP]

LDD said:
Does anyone know if there is an event that fires only on the intital
startup?

\\\
Private Sub Form1_Activated( _
ByVal sender As Object, _
ByVal e As EventArgs _
) Handles MyBase.Activated
Static IsActivated As Boolean
If Not IsActivated Then
IsActivated = True
...
End If
End Sub
///

In .NET 2.0 Windows Forms forms have a 'Shown' event.
 
T

T3rM1ght

dont you mean the _Load event?

the event which fires when the form is loaded, for exampe:

if your form name is frmMain, then your _Load even handler would look
like so:

Private Sub frmMain_Load(ByVal eventSender As System.Object, _
ByVal eventArgs As System.EventArgs) Handles
MyBase.Load

End Sub
 
G

Guest

you could also set the program to startup to a Public Shared Sub Main sub
which weill only fire when the form loads
 

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

Top