multiple forms

5 pts.
Tags:
VB 2008
I am new to programming.  How do I open a form from the main form and close the main form?

Software/Hardware used:
VB 2008

Answer Wiki

Thanks. We'll let you know when a new response is added.

If you Google “vb mdi sdi” you will find many resources with examples of how to work with multiple forms.
I am guessing your default forms interface in your development environment is SDI (or Single Document Interface). In this mode, the application opens one main form window, and all other form windows open within the first one. Each form within the main form has the main form as a “parent”, so you cannot close the parent without closing the “child” windows.
MDI is Multiple Document Interface. Generally in this approach, you start a “Main” procedure which then launches one or more forms as needed. The “child” forms are then children of the application, not children of the first form window opened. Thus, your main procedure can open a startup window, collect some info (like userid/password) and then that window can be closed and other windows opened as needed.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • carlosdl
    When using the SDI interface in VB, you can have one form call another form, and this form call another. From the called form, you can close the calling one as long as it is not the startup form (you can do this even when the calling form is an MDI container if it was not set as parent of the called form, which is not done by default) . If you close the startup form your application will end. However, you could call your second form, and then hide the first one:
            Dim f As New Form2
            f2.Show()
            Me.Hide()
    But, when doing something like this, if the second form is closed there will be no visible forms but the application will continue running, so this is something that needs to be considered.
    69,510 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following