Community discussion forum

MDI

Tags: Indonesia
  • 1 year ago

    hiiiiiiiiiiii,

    i've problem, i'm using MDI for  my application.

    how to set program like this, if i already open 1 form. then if user want open same form, my program can't open the form.. how to do that..

    Please advise

    Thanks.....

  • 1 year ago

    I'm guessing that you are currently using a default instance.  I would recommend staying away from default instances altogether but they are at least OK if you only ever want to show one instance at a time.  The following code displays the default instance of the Form2 class:

    Form2.MdiParent = Me
    Form2.Show()
    Now, there is only one default instance so executing that same code again will simply display the same instance again.

    If you want to display multiple instances of the same form class then don't use the default instance.  You should explicitly create an instance and show that:

    Dim f2 As New Form2
    
    f2.MdiParent = Me
    f2.Show()
    That will create a new instance each time, so you can show as many as you like.

    This is why default instances are a bad idea: they lull people into believing that forms are somehow different to other objects. 

  • 1 year ago

    thanks for your answer...

    but if i'm not declared the form, i got message error from program.

    Reference to a non-shared member requires an object reference.

    FYI, i'm using vb.net 2003..

    Please advise

  • 1 year ago

    I can do it . now... thanks a lot....

Post a reply

Enter your message below

Sign in or Join us (it's free).

Want to stay in touch with what's going on? Follow us on twitter!