Smile[Help] Button Clicking [solved]

Posts 1–7 of 7 · Page 1 of 1
[Help] Button Clicking [solved]
So I know how to make it so when you click a button something happens but how do I make it click and have it turn off? And how would I make the text change too saying like, ON (When you click it) and OFF (when you don't) Thanks in advance guys. If you need more information and what not please reply back.
Change the button's text to OFF and double-click on it in the Form Designer.

It should look something like this:
[highlight=vb.net]
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Button1.Text = "ON" Then 'If I click on the button and the button says 'ON' then..
Button1.Text = "OFF" 'Set the text to OFF
'Add here what happens when you turn it off
ElseIf Button1.Text = "OFF" Then 'If I click on the button and the button says 'OFF' then..
Button1.Text = "ON" 'Set the text to ON
'Add here what happens when you turn it on
End If
End Sub[/highlight]
Code:
If Button1.Text = "ON" Then
Button1.Text = "OFF"
ElseIf Button1.Text = "OFF" Then
Button1.Text = "ON"
End If
Not sure if there's a "Then" after the ElseIf, and too lazy to google

Pseudocode

I HATE YOU MASTER >_>

We posted the same thing LOL. i didn't even know you posted
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MessageBox.Show("On")
    End Sub
Code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        MessageBox.Show("Off")
    End Sub
End Class
Lol fuko, you missed the entire point
Thanks guys, works like a charm <33
Thread marked resolved. No more posting is necessary. I'M BACK!
Posts 1–7 of 7 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Talk with us