malvic
malvic

Reputation: 51

Toggle button color VB.net?

I'm currently ussing the following code to change my buttons into orange once clicked but i would like to make it toggle between grey and orange so if clicked once it shows orange; if clicked again it shows grey and clicked again orange then grey orange then.... and so on

Private Sub F_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles F.Click
TextBox1.Text = 32
F.BackColor = Color.Orange

Upvotes: 1

Views: 3823

Answers (1)

Bala R
Bala R

Reputation: 108957

F.BackColor = IIf(F.BackColor = Color.Orange, Color.Grey, Color.Orange)

Upvotes: 2

Related Questions