|
-
April 17th, 2001, 11:07 PM
#1
Visual Basic
Is there any way by which i can store the name of a form in a variable and then load the form using this variable.
Thanks.
Pathak
-
April 18th, 2001, 02:23 AM
#2
Re: Visual Basic
try this:
Dim fMainForm as frmMain
set fMainForm = new frmMain
fMainForm.Load
Where frmMain is the name of your form.
you may declare fMainForm as public so that you can access it any where in the project.
-
April 18th, 2001, 08:07 AM
#3
Re: Visual Basic
You can use something like that:
'In Module
option Explicit
public strFormName as string
public Sub LoadPrevious()
Select Case strFormName
Case "Form1"
Form1.Show
Case "Form2"
Form2.Show
Case "Form3"
Form3.Show
End Select
End Sub
In your forms in the place you want assign a new value to strFormName. Let's say if you do in Form1:
private Sub Form_Unload(Cancel as Integer)
strFormName = "Form1"
End Sub
then later you can load Form1 from any place of your code by calling LoadPrevious. The scenario might be more complicated, like you can use array to store several values.
HTH
Vlad
-
April 18th, 2001, 03:36 PM
#4
Re: Visual Basic
Dim x as Form, strName as string
strName = Text1.Text
set x = Forms.Add(strName)
x.Show
John G
-
April 22nd, 2001, 01:05 AM
#5
Re: Visual Basic
This I have tried, here I know frmmain is the form to be opened but i want "frmmain" to be stored in a variable (bcoz i am retriveing the forms name from a table a table)
-
April 22nd, 2001, 01:19 AM
#6
Re: Visual Basic
Thanks, this solved my problem
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
|