|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Application.Exit or EndWhich is the appropriate one to use in the above choice?
VB.Net. .Net Framework 1.1 Thank you, Pete Pete Smith wrote:
> Which is the appropriate one to use in the above choice? As far as I know both should be avoided unless you have a specific > VB.Net. .Net Framework 1.1 > Thank you, > Pete > > 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 Show quoteHide quote "Chris" <no@spam.com> wrote in message news:eLoKcmeJGHA.3492@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" <PeteSmit***@hotmail.com> schrieb: Both will release resources, but custom cleanup code may not be executed! > 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. 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/> 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 .. Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message news:Oprp8RfJGHA.312@TK2MSFTNGP09.phx.gbl... > "Pete Smith" <PeteSmit***@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" <PeteSmit***@hotmail.com> schrieb: Simply call 'Me.Close()' inside the form instead of calling 'End' or > 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. 'Application.Exit'. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> "Pete Smith" <PeteSmit***@hotmail.com> wrote in message If the .Net version of 'End' works anything like the VB6 version, use news:urSxiNfJGHA.604@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 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? -- Show quoteHide quoteDennis 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 > "Dennis" <Den***@discussions.microsoft.com> wrote in message You close the form (Unload Me).news:EB1DF272-5997-4A01-A8DA-453935FFB876@microsoft.com... > What do you do if you start you application from a sub main and open a > form > within sub main? <shame> Oops... I had a VB.Classic flashback.... it's Me.Close. Just like H.
Wagner said in another post. Show quoteHide quote "CMM" <cmm@nospam.com> wrote in message news:Oz22T%23iJGHA.3000@TK2MSFTNGP14.phx.gbl... > "Dennis" <Den***@discussions.microsoft.com> wrote in message > news:EB1DF272-5997-4A01-A8DA-453935FFB876@microsoft.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,
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 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. Show quoteHide quote "Pete Smith" <PeteSmit***@hotmail.com> escribió en el mensaje news:umifBXeJGHA.424@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 Let me give my opinion about how to properly close a Windows Formsnews:OJZm0oyJGHA.2036@TK2MSFTNGP14.phx.gbl... Hello group, 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. Show quoteHide quote "Pete Smith" <PeteSmit***@hotmail.com> escribió en el mensaje news:umifBXeJGHA.424@TK2MSFTNGP12.phx.gbl... | Which is the appropriate one to use in the above choice? | VB.Net. .Net Framework 1.1 | Thank you, | Pete
VB2005 pro Graphics
IsDate("ISomeTimesHateProgrammingMarch2005") = True Query Builder Better way to go from ArrayList to Object() Convert from C# to VB.Net Simple (I hope) SteamReader DirectoryInfo question Dataset requery Assigning ListBox Current Selection to TextBox FileSystemObject filter? File Info Question |
|||||||||||||||||||||||