Click to See Complete Forum and Search --> : URGENT : Loading forms using formnames in strings


chilakamati
October 2nd, 1999, 02:43 AM
Is it possible to load using a formname in a string variable
For eg.,
<vbcode>
strFormName = "Form1"
Load strFormName
</vbcode>

Please send me a solution for this !!

Bruno
October 2nd, 1999, 08:39 AM
Here it is. Without SP3 for VB6, it won't work when compiled.

private Sub Form_Click()
Dim x as Form
set x = Forms.Add("Form2")
x.Show
End Sub
' or
private Sub Form_Click()
Forms.Add("Form2").Show
End Sub
' or
private Sub Form_Click()
Dim x as Form
set x = CallByName(Forms, "Add", VbMethod, "Form2")
x.Show
End Sub