Which is the appropriate one to use in the above choice?
VB.Net. .Net Framework 1.1
Thank you,
Pete 12 2614
Pete Smith wrote: Which is the appropriate one to use in the above choice? VB.Net. .Net Framework 1.1 Thank you, Pete
As far as I know both should be avoided unless you have a specific
reason to use it. In most cases closing the forms will exit the
program. Why are you trying to use either?
chris
My understating is by calling the above statements will close the
application properly. Like releasing all the resources.... etc.
That is the reason why I am calling the above statements.
Pete
"Chris" <no@spam.com> wrote in message
news:eL**************@TK2MSFTNGP09.phx.gbl... Pete Smith wrote: Which is the appropriate one to use in the above choice? VB.Net. .Net Framework 1.1 Thank you, Pete
As far as I know both should be avoided unless you have a specific reason to use it. In most cases closing the forms will exit the program. Why are you trying to use either?
chris
"Pete Smith" <Pe*********@hotmail.com> schrieb: My understating is by calling the above statements will close the application properly. Like releasing all the resources.... etc.
That is the reason why I am calling the above statements.
Both will release resources, but custom cleanup code may not be executed!
Could you describe the design of your application in more detail and where
you are calling 'End'/'Application.Exit'?
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
"Pete Smith" <Pe*********@hotmail.com> wrote in message
news:ur*************@TK2MSFTNGP14.phx.gbl... My understating is by calling the above statements will close the application properly. Like releasing all the resources.... etc.
That is the reason why I am calling the above statements.
Pete
If the .Net version of 'End' works anything like the VB6 version, use
anything else. In VB6, sure, it stops the app but in a way that's similar to
shutting your car off while driving. iow, it "yanks the plug" on the app,
possibly leaving automation objects hanging around waiting for task manager
intervention.
--
Ken Halter - MS-MVP-VB (visiting from VB6 world) - http://www.vbsight.com
Please keep all discussions in the groups..
What do you do if you start you application from a sub main and open a form
within sub main?
--
Dennis in Houston
"Chris" wrote: Pete Smith wrote: Which is the appropriate one to use in the above choice? VB.Net. .Net Framework 1.1 Thank you, Pete
As far as I know both should be avoided unless you have a specific reason to use it. In most cases closing the forms will exit the program. Why are you trying to use either?
chris
Application is basically gets the data from the database and prints in a
particualr format. When the user clicks the "Exit" button or "X" on the
right top of the windows form, the application will close.
Thank you,
Pete
..
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:Op*************@TK2MSFTNGP09.phx.gbl... "Pete Smith" <Pe*********@hotmail.com> schrieb: My understating is by calling the above statements will close the application properly. Like releasing all the resources.... etc.
That is the reason why I am calling the above statements.
Both will release resources, but custom cleanup code may not be executed! Could you describe the design of your application in more detail and where you are calling 'End'/'Application.Exit'?
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
"Dennis" <De****@discussions.microsoft.com> wrote in message
news:EB**********************************@microsof t.com... What do you do if you start you application from a sub main and open a form within sub main?
You close the form (Unload Me).
"Pete Smith" <Pe*********@hotmail.com> schrieb: Application is basically gets the data from the database and prints in a particualr format. When the user clicks the "Exit" button or "X" on the right top of the windows form, the application will close.
Simply call 'Me.Close()' inside the form instead of calling 'End' or
'Application.Exit'.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Pete,
In C# (and other languages) is used a Shared Sub Main as starting point of a
program
In VB Net as in VB6 you have the choise between using that Sub Main or using
the inbuild one in your main-form. (Herfried uses forever that Sub Main in
his samples, I use forever that MainForm (form1).
You would never use End for the reason as Ken Halter has explained.
With a Sub Main you would use
application.exit
With a mainform you would use
me.close
I hope this helps,
Cor
<shame> Oops... I had a VB.Classic flashback.... it's Me.Close. Just like H.
Wagner said in another post.
"CMM" <cm*@nospam.com> wrote in message
news:Oz****************@TK2MSFTNGP14.phx.gbl... "Dennis" <De****@discussions.microsoft.com> wrote in message news:EB**********************************@microsof t.com... What do you do if you start you application from a sub main and open a form within sub main?
You close the form (Unload Me).
Hello group,
Let me give my opinion about how to properly close a Windows Forms application:
If you haven't a Sub Main, that is, your starting object inherits from System.Windows.Forms.Form, you should finish by closing the main form. You can use Application.Exit (or ThreadExit) or even Environment.Exit, but it won't fire events like Closing or Close.
If you have a Sub Main, you can use Application.Run to start one or more consecutive message pumps. You can do it in two ways:
· Using Application.Run(): You have to quit from the message pump by executing Application.Exit (or ThreadExit if you use multiple threads). The inconvenient has been noted above.
· Using Application.Run(ApplicationContext) or Application.Run(Form): This way you work just like when you have one main form: closing the form will finish the message pump. Additionally, if you use an ApplicationContext you can change the ApplicationContext.MainForm at any time, efectively changing your application's main form (the form that will end the message pump when closed). You can still use Application.Exit or ThreadExit to quit without invoking further events.
Regards.
"Pete Smith" <Pe*********@hotmail.com> escribió en el mensaje news:um*************@TK2MSFTNGP12.phx.gbl...
| Which is the appropriate one to use in the above choice?
| VB.Net. .Net Framework 1.1
| Thank you,
| Pete
Thank you for your thoughts.
-Pete
"José Manuel Agüero" <chema012 en hotmail.com> wrote in message
news:OJ**************@TK2MSFTNGP14.phx.gbl...
Hello group,
Let me give my opinion about how to properly close a Windows Forms
application:
If you haven't a Sub Main, that is, your starting object inherits from
System.Windows.Forms.Form, you should finish by closing the main form. You
can use Application.Exit (or ThreadExit) or even Environment.Exit, but it
won't fire events like Closing or Close.
If you have a Sub Main, you can use Application.Run to start one or more
consecutive message pumps. You can do it in two ways:
· Using Application.Run(): You have to quit from the message pump by
executing Application.Exit (or ThreadExit if you use multiple threads). The
inconvenient has been noted above.
· Using Application.Run(ApplicationContext) or Application.Run(Form): This
way you work just like when you have one main form: closing the form will
finish the message pump. Additionally, if you use an ApplicationContext you
can change the ApplicationContext.MainForm at any time, efectively changing
your application's main form (the form that will end the message pump when
closed). You can still use Application.Exit or ThreadExit to quit without
invoking further events.
Regards.
"Pete Smith" <Pe*********@hotmail.com> escribió en el mensaje
news:um*************@TK2MSFTNGP12.phx.gbl...
| Which is the appropriate one to use in the above choice?
| VB.Net. .Net Framework 1.1
| Thank you,
| Pete This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Guinness Mann |
last post by:
Pardon me if this is not the optimum newsgroup for this post, but it's
the only .NET newsgroup I read and I'm certain someone here can help me.
I have a C# program that checks for an error...
|
by: Brendan Miller |
last post by:
I am trying to close my application using Application.exit() in the
frmMain_Closing event. When the form closes the process does not. My
application only has one form (no other classes either). ...
|
by: orekin |
last post by:
Hi There
I have been trying to come to grips with Application.Run(),
Application.Exit() and the Message Pump and I would really appreciate
some feedback on the following questions .. There are...
|
by: Ioannis Vranos |
last post by:
I am currently reading a chapter involving multithreading, and some sample code calls
Environment::Exit() to terminate the application with all threads.
What is the difference from...
|
by: John Wildes |
last post by:
Hello All
I have an application that has one form. I start the application using a
Application.Run(New frmMain) command in Sub Main(). When I exit, the exit
menu Item simply does a Me.Close ....
| |
by: Bob Day |
last post by:
Using VS 2003, VB.net...
I am confused about the Application.Exit method, where the help states "This
method does not force the application to exit." Aside from the naming
confusion, how do I...
|
by: Peter Oliphant |
last post by:
How does one launch multiple forms in an application?
Using Photoshop as an example, this application seems to be composed of many
'disjoint' forms. Yet, they all seem somewhat 'active' in...
|
by: Marcel Saucier |
last post by:
I have written a Console Application then created a shortcut to it on my
desktop. I was able to minimize the DOS window when I click my shortcut so I
dont see anymore the DOS window
But, using...
|
by: Jay |
last post by:
In my C# code, I'm attempting to display a message box then quit the win form application I'm
writing if a certain type of error occurs when the application starts up.
In the main form's...
|
by: =?Utf-8?B?VGFvZ2U=?= |
last post by:
Hi All,
When I use applcation.exit() in winForm application, the form closed, but
the process is still going!! ( The debug process is still running if debug in
VS IDE). Environment.Exit(0) works...
|
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,...
| |
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...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |