Change the look of a button.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello all,

Can you take a button, color it green, have the user click on it, change the
color to red, to show it has been selected. IF so, how?

As always, thank in advance!

Rudy
 
Rudy said:
Can you take a button, color it green, have the user click on it, change
the
color to red, to show it has been selected. IF so, how?

\\\
DirectCast(sender, Control).BackColor = Colors.Red
///
 
Rudy,

Maybe it can shorter however this works
\\\
If Button1.BackColor.ToArgb = Color.Red.ToArgb Then
Button1.BackColor = Color.Green
Else
Button1.BackColor = Color.Red
End If
///
I hope this helps?

Cor
 
Easy, Trap the button click event and change the backcolor

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click

btnSave.backcolor = system.drawing.color.red

End Sub

Hope is helps

Chris
 
Cor Ligthert said:
Maybe it can shorter however this works
\\\
If Button1.BackColor.ToArgb = Color.Red.ToArgb Then

\\\
If Button1.BackColor.Equals(Color.Red) Then
...
End If
///

Just my 2 Euro cents...
 
Herfried,

I was curious in changing the rgb values with an Or or something, this is
not shorter however nothing wrong with.

Cor

"Herfried K. Wagner [MVP]"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top