473,320 Members | 2,104 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,320 software developers and data experts.

Controls - background colour

Al
I hope I'm in the right group for this question.

I'm new to VB.net and am trying to change the background color of a button
when it is "clicked."

I'm using the code

"ctl..BackColor = System.Drawing.Color.Teal"

in the form_load event and it works, however when using the code with a
different color in the ctl_click event of the relevent button, in putting it
in an "If - then" statement, I'm being told that The operator'=' is not
defined.

I've some experience of VBA, however canot work this one out and would be
grateful for any assistance

Thanks

@l@n
Nov 22 '05 #1
4 1246
I take it your doing

If ctl.BackColor = Color.Teal Then........

Color does not support the = operator.. check out Color.Op_Equality.. I
think..

not sure if this is the best or most efficient.. but it works..

HTH

"Al@n" <no*@thisdomain.co.uk> wrote in message
news:#U**************@TK2MSFTNGP10.phx.gbl...
I hope I'm in the right group for this question.

I'm new to VB.net and am trying to change the background color of a button
when it is "clicked."

I'm using the code

"ctl..BackColor = System.Drawing.Color.Teal"

in the form_load event and it works, however when using the code with a
different color in the ctl_click event of the relevent button, in putting it in an "If - then" statement, I'm being told that The operator'=' is not
defined.

I've some experience of VBA, however canot work this one out and would be
grateful for any assistance

Thanks

@l@n

Nov 22 '05 #2
Al
HTH

Thanks for your assistance. I think I'm on the right track
now. If you have a more efficient way of doing this, I'd
be graeful for any input.

Al@n
-----Original Message-----
I take it your doing

If ctl.BackColor = Color.Teal Then........

Color does not support the = operator.. check out Color.Op_Equality.. Ithink..

not sure if this is the best or most efficient.. but it works..
HTH

"Al@n" <no*@thisdomain.co.uk> wrote in message
news:#U**************@TK2MSFTNGP10.phx.gbl...
I hope I'm in the right group for this question.

I'm new to VB.net and am trying to change the background color of a button when it is "clicked."

I'm using the code

"ctl..BackColor = System.Drawing.Color.Teal"

in the form_load event and it works, however when using the code with a different color in the ctl_click event of the relevent button, in putting
it
in an "If - then" statement, I'm being told that The

operator'=' is not defined.

I've some experience of VBA, however canot work this one out and would be grateful for any assistance

Thanks

@l@n

.

Nov 22 '05 #3
ur welcome..

I'm not saying this IS inefficient.. just not sure if there's a more
efficient way of doing it. if there is I haven't come across it yet.

I'm fairly new to .NET myself.. so if anyone else has any input???

HTH - Hope This Helps.. not my name..

Rigga. (This is my name.. ) ;-)

"Al@n" <an*******@discussions.microsoft.com> wrote in message
news:31****************************@phx.gbl...
HTH

Thanks for your assistance. I think I'm on the right track
now. If you have a more efficient way of doing this, I'd
be graeful for any input.

Al@n
-----Original Message-----
I take it your doing

If ctl.BackColor = Color.Teal Then........

Color does not support the = operator.. check out

Color.Op_Equality.. I
think..

not sure if this is the best or most efficient.. but it

works..

HTH

"Al@n" <no*@thisdomain.co.uk> wrote in message
news:#U**************@TK2MSFTNGP10.phx.gbl...
I hope I'm in the right group for this question.

I'm new to VB.net and am trying to change the background color of a button when it is "clicked."

I'm using the code

"ctl..BackColor = System.Drawing.Color.Teal"

in the form_load event and it works, however when using the code with a different color in the ctl_click event of the relevent button, in putting
it
in an "If - then" statement, I'm being told that The

operator'=' is not defined.

I've some experience of VBA, however canot work this one out and would be grateful for any assistance

Thanks

@l@n

.

Nov 22 '05 #4
The other way is to use Equals.

Color1.Equals(Color2)
"Rigga" <s@g.c> wrote in message
news:IH*********************@stones.force9.net...
ur welcome..

I'm not saying this IS inefficient.. just not sure if there's a more
efficient way of doing it. if there is I haven't come across it yet.

I'm fairly new to .NET myself.. so if anyone else has any input???

HTH - Hope This Helps.. not my name..

Rigga. (This is my name.. ) ;-)

"Al@n" <an*******@discussions.microsoft.com> wrote in message
news:31****************************@phx.gbl...
HTH

Thanks for your assistance. I think I'm on the right track
now. If you have a more efficient way of doing this, I'd
be graeful for any input.

Al@n
-----Original Message-----
I take it your doing

If ctl.BackColor = Color.Teal Then........

Color does not support the = operator.. check out

Color.Op_Equality.. I
think..

not sure if this is the best or most efficient.. but it

works..

HTH

"Al@n" <no*@thisdomain.co.uk> wrote in message
news:#U**************@TK2MSFTNGP10.phx.gbl...
> I hope I'm in the right group for this question.
>
> I'm new to VB.net and am trying to change the

background color of a button
> when it is "clicked."
>
> I'm using the code
>
> "ctl..BackColor = System.Drawing.Color.Teal"
>
> in the form_load event and it works, however when using

the code with a
> different color in the ctl_click event of the relevent

button, in putting
it
> in an "If - then" statement, I'm being told that The

operator'=' is not
> defined.
>
> I've some experience of VBA, however canot work this

one out and would be
> grateful for any assistance
>
> Thanks
>
> @l@n
>
>
.


Nov 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Dj Frenzy | last post by:
Hi, I know how to use javascript to change a background image to another background image, and how to change a background colour to another background colour. Is there a way to change an image to a...
6
by: Louise | last post by:
Hi I have written an HTML pages which does not have any colour specifying tags as far I know. When I view this in an Microsoft internet explorer browser it appears with a white background and...
3
by: Peter Williams | last post by:
Hi All, I want to write some javascript for a html page which does the following. Imagine that the page contains a table with 2 columns and 3 rows, e.g.: +---+---+ | A | B | +---+---+
4
by: Lachlan Hunt | last post by:
Hi, I'm looking for an interoperable method of determining the current background colour of an element that is set using an external stylesheet. I've tried: elmt.style.backgroundColor; but...
10
by: Bob Bedford | last post by:
I've a table in wich I've this CSS: ..oddrow{background-color:#FFFFFF} ..evenrow{background-color:#CCCCCC} The oddrows are white and the even are grey. BUT ! when I do print the table,...
2
by: bissatch | last post by:
Hi, I am running a w3c CSS validation check on a site in development. I have many errors saying that my CSS is not valid because I have not defined the background-color but instead left it...
0
by: Tim Marshall | last post by:
A2003. I rather like the appearance I get with windows themed controls turned on, but I'm running into an odd problem with tab controls. When I set the back style to transparent, it really isn't...
3
by: Haines Brown | last post by:
A minor issue. When I try to validate a CSS line, I get an error. The line inside the style for a div is background-color: #FFFBF0; The warning (jigsaw.w3.org) is: Line : 54 (Level : 1)...
1
by: =?Utf-8?B?U3RldmUgUmFuZGFsbA==?= | last post by:
I have a form with a number of panel controls on it. I have overriden the paint event (of the panel controls) to provide custom painting. What I have done is to use the Paint event to paint the...
3
Frinavale
by: Frinavale | last post by:
Hi there, I'm using JavaScript to highlight a row or column in a table. I have created a CSS class that changes the background colour to a light blue and I apply this class to the cells in the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.