|
-
Oct 26th, 2006, 02:23 PM
#1
Thread Starter
Lively Member
[RESOLVED] If Statement Help
Hi, another dorky question from me.
Using VB 6
-------------------------------------
I would like to use an "If" statement to handle
the loading & showing of a form.
Something like:
Private Sub HandleForm()
Load Form1
If ***Form1 has completely loaded*** Then Form1.Show
End Sub
-------------------------------------
I'm want to handle a form in this manner, because my program will be executing other stuff while Form1 is loading.
Thanks!!!
-
Oct 26th, 2006, 02:24 PM
#2
Member
-
Oct 26th, 2006, 02:45 PM
#3
Lively Member
Re: If Statement Help
Hello!
VB Code:
Private Sub Form_Handle()
if form1.visible = true then
show form2
End Sub
Do you mean soming like that ! ?
-
Oct 26th, 2006, 02:46 PM
#4
Re: If Statement Help
Try this:
VB Code:
'start checking for "is loaded"
Private Sub Command1_Click()
Do Until isLoaded("Form1") = True
'do your thing
DoEvents
Loop
Form1.Show
End Sub
'load it - Form1 should show after you click this
'and after Form1 is in the Forms collection
Private Sub Command2_Click()
Load Form1
End Sub
Private Function isLoaded(frm As String) As Boolean
Dim f As Form
For Each f In Forms
If f.Name = frm Then
isLoaded = True
Exit Function
End If
Next
End Function
-
Oct 26th, 2006, 02:47 PM
#5
Re: If Statement Help
I'm a little confused about the statement.. as long as you don't have WindowState set as Minimized, it should show itself automatically...
-
Oct 26th, 2006, 03:23 PM
#6
Re: If Statement Help
 Originally Posted by timeshifter
I'm a little confused about the statement.. as long as you don't have WindowState set as Minimized, it should show itself automatically...
Load FormName will not automatically show the form. Load only loads the form into memory it doesn't show it. You will have to call show to activate it.
-
Oct 26th, 2006, 03:50 PM
#7
Hyperactive Member
Re: If Statement Help
 Originally Posted by MarkT
Load FormName will not automatically show the form. Load only loads the form into memory it doesn't show it. You will have to call show to activate it.
If you use Load FormName, will it execute the code in the Form_Load event? (I'm thinking it will, just want to be sure.)
-
Oct 26th, 2006, 03:56 PM
#8
Re: If Statement Help
 Originally Posted by disruptivehair
If you use Load FormName, will it execute the code in the Form_Load event? (I'm thinking it will, just want to be sure.)
Yes... btw, is this so hard to try? You create 2 forms, add MsgBox "Can you see me?" in one's Form_Load event and load it from the other
-
Oct 26th, 2006, 03:59 PM
#9
Hyperactive Member
Re: If Statement Help
 Originally Posted by gavio
Yes... btw, is this so hard to try? You create 2 forms, add MsgBox "Can you see me?" in one's Form_Load event and load it from the other 
Sorry gav, you're right; it wouldn't be hard to try if I was at the office where I have access to VB instead of at home where I don't.
-
Oct 26th, 2006, 04:02 PM
#10
Re: If Statement Help
 Originally Posted by disruptivehair
Sorry gav, you're right; it wouldn't be hard to try if I was at the office where I have access to VB instead of at home where I don't. 
It's been about 20 hours since i'm up... i should get some rest... i'm gettin' a bit "kranky"
-
Oct 26th, 2006, 05:06 PM
#11
Hyperactive Member
Re: If Statement Help
 Originally Posted by gavio
 It's been about 20 hours since i'm up... i should get some rest... i'm gettin' a bit "kranky" 
Yeah, you should get some sleep...and I'm sure if I look at my posts a year from now I'll probably roll my eyes.
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
|