By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,377 Members | 1,697 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,377 IT Pros & Developers. It's quick & easy.

Change the look of a button.

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
12 Replies


P: n/a
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
Nov 21 '05 #2

P: n/a
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
Nov 21 '05 #3

P: n/a
"Rudy" <Ru**@discussions.microsoft.com> schrieb:
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
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #4

P: n/a
"Rudy" <Ru**@discussions.microsoft.com> schrieb:
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
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #5

P: n/a
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

"Rudy" <Ru**@discussions.microsoft.com> wrote in message
news:9A**********************************@microsof t.com...
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

Nov 21 '05 #6

P: n/a
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

"Rudy" <Ru**@discussions.microsoft.com> wrote in message
news:9A**********************************@microsof t.com...
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

Nov 21 '05 #7

P: n/a
"Cor Ligthert" <no************@planet.nl> schrieb:
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 K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #8

P: n/a
"Cor Ligthert" <no************@planet.nl> schrieb:
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 K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #9

P: n/a
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]"
"Cor Ligthert" <no************@planet.nl> schrieb:
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 K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #10

P: n/a
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]"
"Cor Ligthert" <no************@planet.nl> schrieb:
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 K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #11

P: n/a
Thanks for all the tips, I'll try it out tonight!

"Chris" wrote:
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

"Rudy" <Ru**@discussions.microsoft.com> wrote in message
news:9A**********************************@microsof t.com...
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


Nov 21 '05 #12

P: n/a
Thanks for all the tips, I'll try it out tonight!

"Chris" wrote:
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

"Rudy" <Ru**@discussions.microsoft.com> wrote in message
news:9A**********************************@microsof t.com...
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


Nov 21 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.