Results 1 to 6 of 6

Thread: Form Question

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2000
    Posts
    208
    How do I load multiple instances of the same form?

    I get an "object already loaded" error when I use frm.show

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    'this what you are after

    Code:
    Private Sub Command1_Click()
        Dim frm As Form
        Dim x As Integer
        For x = 1 To 4
            Set frm = New Form1
            frm.Visible = True
        Next
    
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2000
    Posts
    208
    Thanks, Joe.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Oct 2000
    Posts
    208
    How do I distinguish between the forms once I've loaded them?

    I'm only able to unload the one that I loaded "directly" (load frm) and not the one that I loaded through a variable (dim frm2 as Form, set frm2 = new frm)

  5. #5
    Hyperactive Member
    Join Date
    Feb 2001
    Location
    LoCal
    Posts
    280
    Unload frm2 ?
    Achichincle

    VB6 (VSEE SP5, W2KPro)
    ASP
    HTML

  6. #6
    Lively Member
    Join Date
    Mar 2000
    Posts
    87
    best thing is when you new up an instance is to add it to a collection. The you have somewhere to retrieve them from.

    Code:
    dim frmInstance as form1
    
    set frmInstance = new form1
    colForms.add frmInstance, cstr(frmInstance.hWnd)
    You can use the handle of the form as a key for it, so if you want to retrieve a specific form you can. You can always create your own keys as well.

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