How to close parent form?

I know that I can't do this in VB2005...


Answer this question

How to close parent form?

  • vesuvius

    Do you mean, how can you work with more than one form and only have one visible at a time You could create a Sub Main procedure and use that as your StartUp object. See: http://msdn2.microsoft.com/en-us/library/17k74w0c(en-US,VS.80).aspx

    Hope this helps,

    Steve Hoag



  • Will Strootman

    At last, I have changed the "Shudown mode" to "When last form closes" on "My project" and now this code is valid

  • Emac80

    I know this, but then, how I can work with more than one form

  • Juan Carlos Trimino

    I forgot about Shutdown mode - that should work fine.

    Not sure I understand your second question - are you asking if "My.Forms.Form2.Show()" is the same as "My.Forms.Form2.Show" without the parentheses In VB 6 either would work, but I believe .NET requires the parentheses after a Method name.

    Or if you are asking if

    dim newform as new form2

    newform.show()

    me.close()

    is the same as

    my.forms.form2.show()

    me.close()

    they are equivalent - the "My" way is a shortcut that automatically declares a new form variable and shows it in a single step.

    Steve Hoag

    Visual Basic Express



  • Igor Taranov -- MSFT

    ecentinela said:

    "At last, I have changed the "Shudown mode" to "When last form closes" on "My project" and now this code is valid"

    Cool..... The default Way suggests that one must end with the start Proc(Form,etc) ....The other choice allows many starts and many ends..... Which is way more General and better in my humble opinion.............


  • skinny

    Ok, then it is a shortcut and I am not losing any functionality or something...

    Thank you for the patience with my "spanglish" (spanish - english) :P

  • MarTim

    It's not clear what you are asking. In Visual Basic 2005, closing the startup form ends the application. No matter how you show the second form, calling Me.Close is going to close the parent form and end the app.

    Steve Hoag

    Visual Basic Express



  • How to close parent form?