|
-
Jan 29th, 2000, 10:17 PM
#1
Thread Starter
New Member
Hi All,
This sounds simple, but I am still stumbling with it. My question is, how do I show a form, let's say "form1" at run-time if I found out the name of the form as "form1" at run-time. I know at design-time, you just say - form1.show.
I would appreciate it greatly if someone could help me out.
Thanx
Nabin
-
Jan 29th, 2000, 10:48 PM
#2
PowerPoster
I think you are somewhat confused. what you wrote e.g Form1.Show is how you show a form at runtime. Type it in a code window (e.g. Command1_Click)
Regards,
------------------
- Chris
[email protected]
If it ain't broke - don't fix it 
-
Jan 29th, 2000, 11:06 PM
#3
Thread Starter
New Member
Well, I may not have worded correctly, but anyway, I found a solution browsing through VB Forums. Thanx to Aaron Young, this is his solution.
Private Sub Command1_Click() LoadForm "Form3", True
End Sub
Sub LoadForm(ByVal Formname As String, Optional ByVal bShow As Boolean = False) Dim iIndex As Integer
'Add the Form to the Forms Collection
'>>> Formname MUST exist to add it to the 'collection <<<
Forms.Add Formname
'Find the Index of the Form we just added For iIndex = 0 To Forms.Count - 1
If Forms(iIndex).Name = Formname Then Exit For
Next
If iIndex < Forms.Count Then
'If the Form Existed Then Load it Load Forms(iIndex)
If bShow Then Forms(iIndex).Show
End If
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
|