473,386 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Change the look of a button.

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
12 1803
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
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
"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
"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
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
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
"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
"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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Martin | last post by:
Anybody know how to change the menu button that is displayed by the Tkinter Menubutton and the (derived from it) OptionMenu classes? I think it must be something from the Motif look and feel which...
2
by: google | last post by:
I have a HTML file that contains an iframe. The HTML file is served by one server. The iframe contains a link to a completely different server. My question is, can any action in the iframe (such...
7
by: John Baker | last post by:
Hi: I imagine there are hundreds of responses to this question, but i cant find any on the site using a search. How do you change the background color of buttons? I know there must be an easy...
3
by: Alpha | last post by:
I have 3 radio buttons for include, exclued or 'select all' from the listbox items. If a user selects the 'Select All' button' then all items in listbox is hi-lited as selected. Now, when user...
7
by: Markus McGee | last post by:
Hi all, I have a quick question...I believe. On my web page, call it page A, I have a drop downlist with runat server enabled. When the drop downlist change event occurs it repopulates a...
3
by: Tom | last post by:
I am writing a Visual basic .Net database application. There are many forms that first let you select and look at a DB record and then when you click a "modify" button you are allowed to change...
5
by: cj | last post by:
..net 2003 I have a form with 1 button and several labels on it. I don't want the button to be the default if enter is pressed. I want the user to have to actually click it for it to work. I...
10
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio...
0
by: Oswald Otte | last post by:
Hello How can I change the look of a disabled JButton? I have made a boardgame with a brown background and brown buttons. I have also put an imageicon on the buttons that has a colored image on...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.