Results 1 to 10 of 10

Thread: form

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2002
    Location
    Istanbul
    Posts
    49

    form

    hii

    i want form show

    but

    i write form name in textbox and click the show button

    how

    thanks
    Calf

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Do you mean this?

    VB Code:
    1. Private MyForm As Form
    2.  
    3. Private Sub Command1_Click()
    4. Set MyForm = Text1.Text
    5. MyForm.Show
    6. End Sub

  3. #3
    Frenzied Member TomGibbons's Avatar
    Join Date
    Feb 2002
    Location
    San Diego, CA Previous Location: UK
    Posts
    1,345
    VB Code:
    1. Private Sub Command1_Click()
    2. Dim frm as Form
    3.     For Each frm in Forms
    4.         if frm.Name = Text1.Text then frm.Show  
    5.     Next
    6. End Sub
    Is this what you mean?

  4. #4
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Code:
    Select Case Text1.Text
       Case "Form1"
           Form1.Show
       Case "Form2"
           Form2.Show
    End Select
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  5. #5
    Frenzied Member TomGibbons's Avatar
    Join Date
    Feb 2002
    Location
    San Diego, CA Previous Location: UK
    Posts
    1,345

    Oops

    Just noticed, Mine only works for loaded forms

  6. #6
    Frenzied Member vbgladiator's Avatar
    Join Date
    May 2001
    Posts
    1,950
    Hack, your code will not work. You must assign a form object to object form. I know how to do this with controls. I don't think you can do this with forms unless they're loaded.
    Don't anthropomorphize computers -- they hate it

  7. #7
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    VB Code:
    1. Private Sub Command1_Click()
    2. Dim frm As Form
    3.  
    4.     Set frm = Forms.Add(txtFormName.Text)
    5.     frm.Show
    6.    
    7. End Sub

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  8. #8
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Ah yes...

    Originally posted by vbgladitor
    Hack, your code will not work. You must assign a form object to object form. I know how to do this with controls. I don't think you can do this with forms unless they're loaded.
    You are correct sir. Thats what I get for posting code I've written off the top of my head without testing it. In fact, the only code that has been posted so far that works on forms not yet loaded is Cander's.

    Sorry for misleading you akyolfatih.

  9. #9
    Frenzied Member vbgladiator's Avatar
    Join Date
    May 2001
    Posts
    1,950
    VB Code:
    1. Private Sub Command1_Click()
    2. Dim frm As Form
    3.  
    4.     Set frm = Forms.Add(txtFormName.Text)
    5.     frm.Show
    6.    
    7. End Sub

    Cool. I knew that. he he he :-)
    Don't anthropomorphize computers -- they hate it

  10. #10
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Thumbs up

    Very nice...

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