By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,909 Members | 2,008 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,909 IT Pros & Developers. It's quick & easy.

Looking for an event that fires only once on startup

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"LDD" <la***************@gmail.com> schrieb:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #2

P: n/a
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

Nov 21 '05 #3

P: n/a
you could also set the program to startup to a Public Shared Sub Main sub
which weill only fire when the form loads
Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.