473,396 Members | 1,810 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.

Why does this code close both of my WinForm windows???

I have a code snippet where if a certain condition is met it creates and
loads an instance of a form and closes the active form that called the
smaller one. The problem is when I call me.close it closes BOTH forms?
Dim frmWizard As New DBWizard

frmWizard.Show()

frmWizard.Focus()

Me.Close()
Nov 20 '05 #1
5 1171
* "Aaron Ackerman" <no@spam.com> scripsit:
I have a code snippet where if a certain condition is met it creates and
loads an instance of a form and closes the active form that called the
smaller one. The problem is when I call me.close it closes BOTH forms?

Dim frmWizard As New DBWizard

frmWizard.Show()

frmWizard.Focus()

Me.Close()


Maybe your application is loosing its message pump.

For a solution, see:

<http://www.google.com/groups?selm=u%23xQOutWDHA.2100%40TK2MSFTNGP11.phx. gbl>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
"Aaron Ackerman" <no@spam.com> schrieb
I have a code snippet where if a certain condition is met it creates
and loads an instance of a form and closes the active form that
called the smaller one. The problem is when I call me.close it closes
BOTH forms?
Dim frmWizard As New DBWizard

frmWizard.Show()

frmWizard.Focus()

Me.Close()


If you specified the first form as the startup object, the application
closes as soon as the form is closed. If you want a different behavior, you
need to write a Sub Main on your own:

shared sub main
dim f as new form1
f.show
application.run
end sub

Now, you have to call application.exitthread when you want the application
to quit.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
My apologies but that is a lousy solution.

"Armin Zingler" <az*******@freenet.de> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
"Aaron Ackerman" <no@spam.com> schrieb
I have a code snippet where if a certain condition is met it creates
and loads an instance of a form and closes the active form that
called the smaller one. The problem is when I call me.close it closes
BOTH forms?
Dim frmWizard As New DBWizard

frmWizard.Show()

frmWizard.Focus()

Me.Close()
If you specified the first form as the startup object, the application
closes as soon as the form is closed. If you want a different behavior,

you need to write a Sub Main on your own:

shared sub main
dim f as new form1
f.show
application.run
end sub

Now, you have to call application.exitthread when you want the application
to quit.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #4
Cor
Hi Aaron,
My apologies but that is a lousy solution.


I don't like it either, but I cannot say it is lousy, can you explain
something more why?

Cor
Nov 20 '05 #5
"Aaron Ackerman" <no@spam.com> schrieb
My apologies but that is a lousy solution.


???

Why? The default sub main nearly looks the same.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #6

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

Similar topics

23
by: JDeats | last post by:
Just spent some time browsing around here: http://msdn.microsoft.com/Longhorn/ I can see the benefits from WinFS (as long as we tag all in-coming data this should be nice, tagging everything...
3
by: Skc | last post by:
My client's project consists of about 6 files maintenance programs that uses WinForm and grid for updates with lookup finders for each file. There is also a User file and security. There are...
7
by: Nikki | last post by:
Hi, Can anybody help me, i want to prevent windows to close my winform of ..NET application, when user presses Alt+F4
3
by: Eric | last post by:
If I have a windows form control declared in my aspx page: <OBJECT id="wcControl" classid="http:MyControl.dll#MyControls.wcControl" height="100%" width="100%" VIEWASTEXT> </OBJECT> Can I not...
3
by: Ken | last post by:
How can I have my WinForm return something to the caller so it knows which button is clicked? The following is calling a system message box, just want to do the samething with my own winform....
22
by: Brett Romero | last post by:
If my UI app uses three DLLs and two of those DLLs reference something named utilities.dll, does the UI app load utilities.dll twice or does the compiler recognize what is going on and load...
10
by: =?Utf-8?B?Tm90cmUgUG91YmVsbGU=?= | last post by:
Hello, I have a legacy MFC application that has a lot of editor functionality associated with a class that extends CFrameWnd. This editor watches for key down events by using the OnKeyDown...
3
by: liorjj | last post by:
Hi, I have a windows application written in C#. I wanted to know why my process does not end after I close my main form (and all the other forms are closed as well) 10x, Lior
5
by: UdayKumarB | last post by:
Hi All, Did Anyone of you are aware of How to Find Windows Application(Winform) Idle time and If so, Close the Application. Thanks, Uday.
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.