I'm still getting used to vb.net, and I've come across a very basic problem that I need a bit of help with, I'm needing so that when I click a button, e.g. Button1, that button changes from purple to black, and then when it is clicked again, it changes back to purple.
Here's how I've tried to do it:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click If Button1.BackColor = Drawing.Color.DarkViolet Then Button1.BackColor = Drawing.Color.Black ElseIf Button1.BackColor = Drawing.Color.Black Then Button1.BackColor = Drawing.Color.DarkViolet End If End Sub
When the page loads the button is DarkViolet, when I click it it turns black, but if I click it again it just stays back.
Again I will reiterate that I'm an absolute beginner. =]