473,396 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Closing previous form

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
3 1137
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
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


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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Miguelito Bain | last post by:
hi everybody- i have a form with 2 fields on it that i want the user to fill out before he or she can save the record, close the record, or move to the next record, etc... here's the code i...
22
by: alecjames1 | last post by:
I have a form which the user must complete before closing. I have disabled the window x button and use my own exit button. When selected it checks to see if the user has completed the entries...
1
by: **Developer** | last post by:
When I get a closing event in a MID Child form I don't know if the child form is closing or the main form is closing. Is there a way to tell? Thank
7
by: spebola | last post by:
I am using VB.Net 2003 professional edition, and .Net Framework 1.1, and Windows forms. What is the proper way to close a windows form displayed by the Show method? I would like it to be removed...
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
2
by: Tom | last post by:
How is the best way to avoid validation when closing a window? For instance, I have a Windows Forms window which has a validation event for a text box. However, if one enters invalid data in then...
1
by: ss | last post by:
Hi I am opening a new form by: ChooseLeve chl = new ChooseLevel(); chl.owner = this; chl.close; i want that when the user clicks on button1 in chl (ChooseLevel), the preiouse form will be...
14
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using VS2005 and .net 2.0. I'm creating an application that has 3 forms. I want allow users to move forward and backward with the forms and retain the data users have entered. I thought...
3
by: Gilberto | last post by:
Hello This must be pretty simple but i havent found the way to do it. I have a form with a button that opens another form on click. WHAT command and WHERE do i need to CLOSE the previous form...
11
by: Simon van Beek | last post by:
Dear reader, By opening an application I get always the main Access window with the closing cross in the above right corner. Is there a possibility to make this closing cross invisible? ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.