Closing a form after opening another

A

Anthony P.

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
 
K

kimiraikkonen

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

Family Tree Mike

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top