Closing a form after opening another  
Author Message
Rani





PostPosted: Fri Mar 28 04:18:36 CDT 2008 Top

Visual Basic [VB] >> 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_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnAcceptEULA.Click

frmInstallationFormStep1.Show()
Me.Close()
End Sub

Now, when the user clicks on the EULA accept button (btnAcceptEULA)
the frmInstallationFormStep1 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
frmInstallationStep1 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

Visual Studio31  
 
 
kimiraikkonen





PostPosted: Fri Mar 28 04:18:36 CDT 2008 Top

Visual Basic [VB] >> 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_Click(ByVal sender As System.Object, ByVal e
> As System.EventArgs) Handles btnAcceptEULA.Click
>
> frmInstallationFormStep1.Show()
> Me.Close()
> End Sub
>
> Now, when the user clicks on the EULA accept button (btnAcceptEULA)
> the frmInstallationFormStep1 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
> frmInstallationStep1 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.

 
 
FamilyTreeMike





PostPosted: Fri Mar 28 06:35:01 CDT 2008 Top

Visual Basic [VB] >> 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.



> 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_Click(ByVal sender As System.Object, ByVal e
> As System.EventArgs) Handles btnAcceptEULA.Click
>
> frmInstallationFormStep1.Show()
> Me.Close()
> End Sub
>
> Now, when the user clicks on the EULA accept button (btnAcceptEULA)
> the frmInstallationFormStep1 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
> frmInstallationStep1 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
>
 
 
David





PostPosted: Sun Mar 30 04:00:15 CDT 2008 Top

Visual Basic [VB] >> 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



> 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.
>

>
>> 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_Click(ByVal sender As System.Object, ByVal e
>> As System.EventArgs) Handles btnAcceptEULA.Click
>>
>> frmInstallationFormStep1.Show()
>> Me.Close()
>> End Sub
>>
>> Now, when the user clicks on the EULA accept button (btnAcceptEULA)
>> the frmInstallationFormStep1 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
>> frmInstallationStep1 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
>>