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!

How to convert String to Form?

Status
Not open for further replies.

gundie

Programmer
Feb 5, 2004
69
US
I have a table that contains a list of users and their access to certain forms.

Code:
[u]User[/u]       [u]Form[/u]
Tom        Form1
Jane       Form1
Jane       Form2
Peter      Form3

This table is read when the application first loads. How can I convert the form string (Form1, Form2, Form3...) to a form name where I can do something like:

Form1.show
Form2.show

Thanks a lot!
 
You could use a Select Case on Form.

Dim objForm as New Form

Select Case Form
Case "Form1"
objForm = Form1
Case "Form2"
objForm = Form2
End Select

objForm.Show
 
Thanks for the reply! I should've mentioned that I wanted to make this as 'dynamic' as possible, meaning I don't want to use conditional statement if at all possible. I have over 70 forms in this project, and using conditional statement is hard to maintain.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top