By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,041 Members | 1,099 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,041 IT Pros & Developers. It's quick & easy.

Closing previous form

P: n/a
In Visual Studio.Net I've created 2 forms for a Windows app using VB.Net -
lets say the forms are frmAlpha and frmBeta

By default the app opens in frmAlpha. On button click I want to go to
frmBeta (I declare frmBeta as a new form near the top of frmAlpha and in
the click procedure I just call form.show(). It works. So far so good.

But, I want frmAlpha to CLOSE as soon as I've clicked to frmBeta. How do I
close it????
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi Eagle,

There are two methods used in this newsgroups.
- some use an extra module sub Main to control the forms
- some use the included sub Main from the form in the Form class.

(When you have no module Main with application start than you use the second
one).

Your situation is a good situation to use the first, however not mine
method.

What I would do is making your second form your mainform and start in that
one in the load event from what you now call your first with a show.dialog
(that is a nice method for a splash form where you in my idea are after)

I hope this helps?

Cor
Nov 20 '05 #2

P: n/a
The only thing is ... I would really like to CLOSE that form rather than
hide it. And with me.close(), the whole application closes. Any
suggestions Mark?
"Mark Wills" <Ma*******@discussions.microsoft.com> wrote in message
news:38**********************************@microsof t.com...
Try this :-)

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim SecondForm As New Form2
SecondForm.Show()
Me.Hide()
End Sub

"Eagle-i" wrote:
In Visual Studio.Net I've created 2 forms for a Windows app using B.Net - lets say the forms are frmAlpha and frmBeta

By default the app opens in frmAlpha. On button click I want to go to
frmBeta (I declare frmBeta as a new form near the top of frmAlpha and in the click procedure I just call form.show(). It works. So far so good.

But, I want frmAlpha to CLOSE as soon as I've clicked to frmBeta. How do I close it????

Nov 20 '05 #3

P: n/a


The application is closed because the mainForm is closed.

you can try using Application.Run() without mainForm as parameter.

Atara

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.