Results 1 to 4 of 4

Thread: MDI form confusion

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2002
    Location
    Bandung - Indonesia
    Posts
    14

    MDI form confusion

    Hi guys,
    I have a little problem when creating MDI style in VB.NET. In the MDIcontainer form (Form1) , I put a button and in its click event I wrote these codes:

    dim frmchild as New form2
    frmchild.MDIParent = Me
    frmchild.Show()

    OK, then the MDIChild showed up...No problemo...it run well. But when I click the button again, another MDIChild form showed in the MDIContainer form...again and again. Is there a way to stop the MDIChild from keep on showing ?

    THX
    K I
    is in the house

    Mail me
    ==========================
    "Finally VB is getting closer to Java haha"

  2. #2
    Addicted Member
    Join Date
    Nov 2000
    Location
    San Diego - California
    Posts
    251
    Private frm as form




    In the button click event ....
    if frm is nothing then
    frm = new myform
    frm.MDIParent = me
    frm.show()
    endif

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2002
    Location
    Bandung - Indonesia
    Posts
    14
    Hi Bryan,
    there's a new problem...
    when I close the MDIChild form and
    try to show it again by clicking the button
    in the MDIContainer, the MDIChild form
    never shows up...weird isn't it?
    K I
    is in the house

    Mail me
    ==========================
    "Finally VB is getting closer to Java haha"

  4. #4
    Addicted Member
    Join Date
    Nov 2000
    Location
    San Diego - California
    Posts
    251
    When you close the form you should set the reference to nothing so that it can re-enter the if statement. ie


    frm.close()
    frm = nothing

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