-
call form
Dear The Expert,
All form names stores to a table and they listed on the listbox,
when the listbox clicked then I can get the form name then store it to a variable.. my question is how to call the form based on the variable I got?
any help would be greatly appreciated and many thanks in advance
Regards
Winanjaya
-
I'm not quite sure I understand what you're looking for, but If I get the general idea correctly...you have your form names stored in a data base and make a call to that database in search of a specific variable (form name). You then want to call that form to load based off the form name stored in the database?...correct...?
If this is correct and the name is stored exactly as it is in your solution you can call the form the way you would if you were using strongly typed commands...
Dim formName as string
********your code to retrieve variable***************
Dim myForm as new formName
myForm.Show()
-or-
myForm.ShowDialog()
If your stored form name is not as it is in your solution then you would have to set up a series of if statements for each possibility and call your form that way
***************************************
if formName = "your variable then
Dim myForm as new Form1
etc....
-
What I need is to store a variable with a form name then call it .. for example: I have a form named "MyForm" ..
I will store "MyForm" to a variable named "formName" then call it .. as I knew this will returned error, so how to deal with this?
Dim formName as string
formName = "MyForm"
then how to show it?
Hopefully you already understand what I need .. ? many thanks in advance
Regards
Winanjaya
-