Hi!
I'm new with VB and i was wondering how to make an exit button. I could buy a book about it, but this is alot cheaper. So if anybody knows, i'd be glad to hear it from you!
Thanx!
Printable View
Hi!
I'm new with VB and i was wondering how to make an exit button. I could buy a book about it, but this is alot cheaper. So if anybody knows, i'd be glad to hear it from you!
Thanx!
Place a command button on the form with the End command in the code window.
Thanks!
As a rule don't use the end command ever.
I'ts all right for simple projects but using the end command stops your vb code in it's tracks, If your doing a more complicated project you will need to do certain things before you close your project, it's mainly when you start making your own class modules and usercontrolls, or start using the API that you'll have to do this but using the end command is a bad habit to get into.
Instead of end try unload form1 on your exit button. then put
msgBox "Goodbye"
in the form terminate event try ending with Unload Form1 in one command button and End in another only the first one will show your message box.
It's not absolutely vital for small projects but for more complicated projects you can actually chash your machine by using the end command (Only if you're using some bits of the API though so don't panic)
As a rule don't use the end command ever.
I'ts all right for simple projects but using the end command stops your vb code in it's tracks, If your doing a more complicated project you will need to do certain things before you close your project, it's mainly when you start making your own class modules and usercontrolls, or start using the API that you'll have to do this but using the end command is a bad habit to get into.
Instead of end try unload form1 on your exit button. then put
msgBox "Goodbye"
in the form terminate event try ending with Unload Form1 in one command button and End in another only the first one will show your message box.
It's not absolutely vital for small projects but for more complicated projects you can actually crash your machine by using the end command (Only if you're using some bits of the API though so don't panic)