|
-
Jan 30th, 2004, 02:17 PM
#1
Thread Starter
Registered User
quick qustion.. form finished loading event
what handle do i put on a sub so that it gets called when a form is completely finished loading and all its components are initialized?
-
Jan 30th, 2004, 02:33 PM
#2
You can use the Activate(d) event but it will fire also if the form comes back into focus from another app or form. To make it only fire once wrap a flag check around it:
VB Code:
Static HasRan As Boolean=False
If Not HasRan Then
'put code here
HasRan=True
End If
-
Jan 30th, 2004, 07:11 PM
#3
Thread Starter
Registered User
can you have a sub that executes every time the form loads, without being called by an event, as if it were a console application, for example?
-
Jan 30th, 2004, 07:18 PM
#4
The only thing outside of an event would be the constructor. Why?
-
Jan 31st, 2004, 02:01 PM
#5
Thread Starter
Registered User
what if, for example you have a textbox that you want to display the time the application started.
where would you set textbox.text = Now().tostring() ???
if you do it in the form designer generated constructor of the textbox, then you can't use the design mode of the form anymore, because vb can't interpret the expression now() at design time and you get an error.
-
Jan 31st, 2004, 03:07 PM
#6
You could use the Load event for that. You could also put it in the constructor after the line that reads: 'Add any initialization after the InitializeComponent() call
ALso if there are any parameters that you want to pass in then you would Overload the constructor to keep the designer working:
Public Sub New(something As String)
Me.New()
'do something with something here
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|