Closing a form after opening another

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Anthony P.

    Closing a form after opening another

    Hello Everyone,

    I'm pretty new to VB.NET and I've run into a snag that I'm not really
    sure how to get around. I'm writing an application that shows a
    splashscreen, then a license agreement. When the user clicks 'I
    accept' to accept the license agreement, the form is supposed to load
    the main application screen and close the license agreement screen. I
    have the following code to accomplish this:

    Private Sub btnAcceptEULA_C lick(ByVal sender As System.Object, ByVal e
    As System.EventArg s) Handles btnAcceptEULA.C lick

    frmInstallation FormStep1.Show( )
    Me.Close()
    End Sub

    Now, when the user clicks on the EULA accept button (btnAcceptEULA)
    the frmInstallation FormStep1 will correctly load but the
    frmDisplayEULA screen (the one showing the license) doesn't close. If
    I add a frmDisplayEULA. Close() call in my LOAD() sub of my
    frmInstallation Step1 nothing happens OR the entire application closes
    when the frmDisplayEULA is closed.

    Can anyone tell me a sensible and correct way to accomplish this? I
    KNOW it's simple but it's driving me batty!

    Thanks,
    Anthony
  • kimiraikkonen

    #2
    Re: Closing a form after opening another

    On Mar 28, 5:02 am, "Anthony P." <papill...@gmai l.comwrote:
    Hello Everyone,
    >
    I'm pretty new to VB.NET and I've run into a snag that I'm not really
    sure how to get around. I'm writing an application that shows a
    splashscreen, then a license agreement. When the user clicks 'I
    accept' to accept the license agreement, the form is supposed to load
    the main application screen and close the license agreement screen. I
    have the following code to accomplish this:
    >
    Private Sub btnAcceptEULA_C lick(ByVal sender As System.Object, ByVal e
    As System.EventArg s) Handles btnAcceptEULA.C lick
    >
    frmInstallation FormStep1.Show( )
    Me.Close()
    End Sub
    >
    Now, when the user clicks on the EULA accept button (btnAcceptEULA)
    the frmInstallation FormStep1 will correctly load but the
    frmDisplayEULA screen (the one showing the license) doesn't close. If
    I add a frmDisplayEULA. Close() call in my LOAD() sub of my
    frmInstallation Step1 nothing happens OR the entire application closes
    when the frmDisplayEULA is closed.
    >
    Can anyone tell me a sensible and correct way to accomplish this? I
    KNOW it's simple but it's driving me batty!
    >
    Thanks,
    Anthony
    Anthony,
    I'm not sure i understood what you want to achieve, but you're closing
    entire project with me.close(), so you should hide() frmDisplayEULA
    instead of closing, use Me.hide() method. But don't forget to "close"
    the EULA form that you hid at the end of your installation steps to
    flush memory.

    Comment

    • =?Utf-8?B?RmFtaWx5IFRyZWUgTWlrZQ==?=

      #3
      RE: Closing a form after opening another

      This sounds like something that you should be doing in a "Setup and
      Deployment" project. This is not available in VB Express, but is in the
      regular Visual Studio. In general though, Kimi's direction will fix your
      immediate question.

      "Anthony P." wrote:
      Hello Everyone,
      >
      I'm pretty new to VB.NET and I've run into a snag that I'm not really
      sure how to get around. I'm writing an application that shows a
      splashscreen, then a license agreement. When the user clicks 'I
      accept' to accept the license agreement, the form is supposed to load
      the main application screen and close the license agreement screen. I
      have the following code to accomplish this:
      >
      Private Sub btnAcceptEULA_C lick(ByVal sender As System.Object, ByVal e
      As System.EventArg s) Handles btnAcceptEULA.C lick
      >
      frmInstallation FormStep1.Show( )
      Me.Close()
      End Sub
      >
      Now, when the user clicks on the EULA accept button (btnAcceptEULA)
      the frmInstallation FormStep1 will correctly load but the
      frmDisplayEULA screen (the one showing the license) doesn't close. If
      I add a frmDisplayEULA. Close() call in my LOAD() sub of my
      frmInstallation Step1 nothing happens OR the entire application closes
      when the frmDisplayEULA is closed.
      >
      Can anyone tell me a sensible and correct way to accomplish this? I
      KNOW it's simple but it's driving me batty!
      >
      Thanks,
      Anthony
      >

      Comment

      • David Griffiths

        #4
        Re: Closing a form after opening another

        Check your project properties. The Application Tab, there is a setting
        "Shutdown Mode" "When startup form closes" or "When Last form closes"

        How is your Splash screen initialised. Is it the first form in the project
        "The startup form" or is it set in the "Splash screen" setting just under
        the "Shutdown Mode"

        --
        DaveG

        "Family Tree Mike" <FamilyTreeMike @discussions.mi crosoft.comwrot e in
        message news:E0AFC257-A025-472B-A545-56BBF71DA217@mi crosoft.com...
        This sounds like something that you should be doing in a "Setup and
        Deployment" project. This is not available in VB Express, but is in the
        regular Visual Studio. In general though, Kimi's direction will fix your
        immediate question.
        >
        "Anthony P." wrote:
        >
        >Hello Everyone,
        >>
        >I'm pretty new to VB.NET and I've run into a snag that I'm not really
        >sure how to get around. I'm writing an application that shows a
        >splashscreen , then a license agreement. When the user clicks 'I
        >accept' to accept the license agreement, the form is supposed to load
        >the main application screen and close the license agreement screen. I
        >have the following code to accomplish this:
        >>
        >Private Sub btnAcceptEULA_C lick(ByVal sender As System.Object, ByVal e
        >As System.EventArg s) Handles btnAcceptEULA.C lick
        >>
        > frmInstallation FormStep1.Show( )
        > Me.Close()
        >End Sub
        >>
        >Now, when the user clicks on the EULA accept button (btnAcceptEULA)
        >the frmInstallation FormStep1 will correctly load but the
        >frmDisplayEU LA screen (the one showing the license) doesn't close. If
        >I add a frmDisplayEULA. Close() call in my LOAD() sub of my
        >frmInstallatio nStep1 nothing happens OR the entire application closes
        >when the frmDisplayEULA is closed.
        >>
        >Can anyone tell me a sensible and correct way to accomplish this? I
        >KNOW it's simple but it's driving me batty!
        >>
        >Thanks,
        >Anthony
        >>

        Comment

        Working...