Results 1 to 4 of 4

Thread: call form

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    784

    Question 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

  2. #2
    Junior Member
    Join Date
    Dec 2003
    Location
    California
    Posts
    19
    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....

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    784
    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

  4. #4

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width