Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening a Form

Status
Not open for further replies.

kingduck

MIS
Oct 31, 2002
41
EG
Hi All;
I have a form object (Or a form name) stored in a variable. How can i open the form stored in this variable?
I Open forms like this.

Dim Varname as new formName
Varname.show

This doesn't work. I need the formName to be a variable not a form name.

Is there any other way to open a form?

Thanks In advance
 
what type is the formname?
it can't be string it needs to be of type form. how are you passing the formname, why?

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
I needed a module that can tell wither a certain form is open or not so that the user doesn't open the same form more than once.
So, i created a class so that i can save the name of each open form. I want that class to handel the opening of the forms.
when, i pass the form name or the form object to the class then the class checks wither the form is open or not if it is open it prevents the new form from being opened.
The current class that i created. Checks the wither the form is open or not and works fine. But, I want to pass the form name or object to the class so it can be opened from within the class.
 
err, kinda low tech, but you can use a select case statement on the sting containing the form name and then set the form object and run your code.

Code:
public sub OpenForm(FormName as string)
dim frmlocal as windows.form
select case FormName
 Case is = "frmMain"
  frmlocal = new frmMain
 Case is = "frmOther"
  frmlocal = new frmOther
end select
frmlocal.show

-Rick

----------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top