Answered Closing Button...

PRo-Beaniie

Well-known member
Joined
Mar 17, 2011
Messages
55
Location
Hertford, Hertfordshire, United Kingdom
Programming Experience
3-5
Hey Guys,

I have just built a full main menu for my pc game however the one thing i cant get my head around is terminating the runnning programme using a button held within the form. I have built a button labeled exit and tried a couple of closing codes such as,

Me.Close
ExitApplication

can any one help me with this one :confused:
 
Last edited:

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,561
Location
Norway
Programming Experience
10+
Me.Close (aka Form.Close method) also close application if it is the startup form and Shutdown mode is 'startup form', or if it is the last form and Shutdown mode is 'last form'.
Application.Exit method closes all open forms and exits the application by default, useful when not in startup form or when having multiple forms open and Shutdown mode is 'last form'.
Both makes FormClosing event be raised, which is a cancellable event, so if forms use this neither may close the form or the application.
 
Top Bottom