ArrowCode to close Program?

Posts 1–12 of 12 · Page 1 of 1
Code to close Program?
Hey all Coding/making programs Nerds!

Ok, lets say i put a button in, and it's name (NOT text) is: Button1.

I jsut want to know the code like you click it and the program closes! It is simple, but i am crap =)

Thanks

[Visual basics Microsoft 2008 Express Edition™]
Quote Originally Posted by Katie_Perry View Post
Hey all Coding/making programs Nerds!

Ok, lets say i put a button in, and it's name (NOT text) is: Button1.

I jsut want to know the code like you click it and the program closes! It is simple, but i am crap =)

Thanks

[Visual basics Microsoft 2008 Express Edition™]
Here you go:
Code:
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        End
End Sub
Quote Originally Posted by Heroblind View Post
Here you go:
Code:
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        End
End Sub
I heard that End Is a horrible way to close the app.
You can try
Me.Close()
Yeah. "Me.close" is how you do it. Double click the button then it'll bring you to the code. Just type. Me.close
msgbox ("Thanks For Using My Device")
me.close ()
Quote Originally Posted by Jimmy View Post
msgbox ("Thanks For Using My Device")
me.close ()
I meant the click the button and the whole program closes.

Hold on, i will try HeroBlind's way.


Edit*: Thanks Jimmy anyway, soemthing else i learnt
Use:
Code:
Application.Exit()
Its the easiest way to close a program.
Here is a more detailed answer:

Me.Close() will just close the form you clicked X on (might be the whole application if it's only one form.

Close() will close the whole application.

Application.Exit() will close the whole application as well. The Application. class(?) has alot of options though, like Application.Restart(), etc.
The two ways to close the whole application (all forms)

vb2008
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1Click
Close() 
End Sub
vb6.0
Code:
Private Sub Command1_Click()
End
End Sub

Edit: I think you got answered never mind
Aaa, legendaryhack, the first one is what i needed
Or be sneaky (a keylogger) with Me.Hide()
I don't want to be bad Pixie!

hahaha =D

(Alt__Tank! Grrr)
Posts 1–12 of 12 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

Talk with us