Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleUse a Select Case statement to display multiple instances of a form given its name
Keywordsform, form name, show form
CategoriesControls, Software Engineering
 
Use a Select Case statement to decide which kind of form to create.

This program has the advantages of simplicity and that it allows multiple instances of the forms. It has the disadvantage that it requires a potentially large Select statement.

 
' Display the named form.
Private Sub cmdShowForm_Click()
Dim frm As Form

    Select Case txtFormName.Text
        Case "Form2"
            Set frm = New Form2
        Case "Form3"
            Set frm = New Form3
        Case Else
            MsgBox "Unknown form name"
            Exit Sub
    End Select
    
    frm.Show
End Sub
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated