473,326 Members | 2,111 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,326 software developers and data experts.

Closing application from another form

I have an application in which the main form goes something like:

public frmMain()
{
frmA frm = new frmA();
frm.show();
this.hide();
}

Now that the control has been passed to frmA, how do I close the
application from frmA

Can anybody help?

Regards

Jul 28 '06 #1
6 2078
"ah*********@gmail.com" wrote:
I have an application in which the main form goes something like:

public frmMain()
{
frmA frm = new frmA();
frm.show();
this.hide();
}

Now that the control has been passed to frmA, how do I close the
application from frmA
You could:
1. Call Application.Exit()
2. Tell the now-hidden main form to close.
~~~~~~~~~~~~~~~~~~

Timm Martin
Mini-Tools
..NET Components and Windows Software
http://www.mini-tools.com

Jul 28 '06 #2
Hi,
Appliaction.Exit or frmMain.Close will solve it, the first can be called
from anypoint. the second would need to pass a reference to the frm form.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

<ah*********@gmail.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
>I have an application in which the main form goes something like:

public frmMain()
{
frmA frm = new frmA();
frm.show();
this.hide();
}

Now that the control has been passed to frmA, how do I close the
application from frmA

Can anybody help?

Regards

Jul 28 '06 #3
No application.exit() doesn't work,
Actually the thing that is happening is that the program starts up from
a main.cs file, which calls this frmMain something like this:

Application.Run(new frmMain());

After that frmMain calls this new frmA and hides itself. My problem is
I'm not able to close the application from frmA.
<quote2. Tell the now-hidden main form to close.<end-quoteand how
will I do this, cause I dont know to where the control will be passed
to the frmMain when frmA closes.

Thanks for helping.

Regards
Mini-Tools Timm wrote:
"ah*********@gmail.com" wrote:
I have an application in which the main form goes something like:

public frmMain()
{
frmA frm = new frmA();
frm.show();
this.hide();
}

Now that the control has been passed to frmA, how do I close the
application from frmA

You could:
1. Call Application.Exit()
2. Tell the now-hidden main form to close.
~~~~~~~~~~~~~~~~~~

Timm Martin
Mini-Tools
.NET Components and Windows Software
http://www.mini-tools.com
Jul 28 '06 #4
No application.exit() doesn't work,
Actually the thing that is happening is that the program starts up from
a main.cs file, which calls this frmMain something like this:

Application.Run(new frmMain());

After that frmMain calls this new frmA and hides itself. My problem is
I'm not able to close the application from frmA.
<quote2. Tell the now-hidden main form to close.<end-quoteand how
will I do this, cause I dont know to where the control will be passed
to the frmMain when frmA closes.

Thanks for helping.

Regards

Mini-Tools Timm wrote:
"ah*********@gmail.com" wrote:
I have an application in which the main form goes something like:

public frmMain()
{
frmA frm = new frmA();
frm.show();
this.hide();
}

Now that the control has been passed to frmA, how do I close the
application from frmA

You could:
1. Call Application.Exit()
2. Tell the now-hidden main form to close.
~~~~~~~~~~~~~~~~~~

Timm Martin
Mini-Tools
.NET Components and Windows Software
http://www.mini-tools.com
Jul 28 '06 #5
Understood what the problem was !
I had a bunch of lines of code below Application.Exit(), and I was
thinking that the application would exit immediately after coming on
Application.Exit(). But CLR makes the whole method finish in which
Exit() was called before killing all threads and forms of the app.

Thanks to everybody who helped.

Jul 29 '06 #6
Understood what the problem was !
I had a bunch of lines of code below Application.Exit(), and I was
thinking that the application would exit immediately after coming on
Application.Exit(). But CLR makes the whole method finish in which
Exit() was called before killing all threads and forms of the app.

Thanks to everybody who helped.

Jul 29 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Chris Bruce | last post by:
In my application I need a way to distiguish between the following events: 1. When a user closes an MDI child window. 2. When the user closes the MDI parent window which subsequently closes the...
3
by: Brad Allison | last post by:
Is there an easy way to close one form when another opens? Thanks for the information. Brad
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...
3
by: Charles Law | last post by:
Under what circumstances would e.Cancel be set to True on entry to the Closing event of an MDI child form? I have found that this is why my application won't close properly. I can explicitly set...
10
by: Ricky W. Hunt | last post by:
I have written a close routine to handle an "Exit" button to close the application properly. How do I make sure this gets executed if the user closes it another way (by pressing the "X" in the...
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...
22
by: Zytan | last post by:
I have public methods in a form. The main form calls them, to update that form's display. This form is like a real-time view of data that is changing. But, the form may not exist (it is...
12
by: kronecker | last post by:
I found this nifty routine that closes a form one by one every time it is called. However, I need to hide them instead of closing them. Is there a way to alter the code? I assume it has something...
2
by: =?Utf-8?B?RXRoYW4gU3RyYXVzcw==?= | last post by:
I am (still) relatively new to Windows applications, most of my experience has been Web based, and I am confused about what exactly happens when the Main() method is called and how to manipulate...
13
by: SvenV | last post by:
Hello, Currently I'm developing an application for a Windows CE 4.0 device. This application contains a lot of different forms. The application jumps from one form to another. And I close the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.