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

BackColor on Label doesn't seem to work

Why doesn't BackColor on a label work (ForeColor works):

Dim theAnswer as Label
theAnswer.ForeColor = System.Drawing.Color.yellow
theAnswer.BackColor = System.Drawing.Color.green

BackColor on DataGridItem works fine.

Dim oGridItem as DataGridItem
oGridItem.BackColor = System.Drawing.Color.green

Thanks,

Tom
Nov 19 '05 #1
3 1567
It works here...

theAnswer.ForeColor = System.Drawing.Color.Yellow
theAnswer.BackColor = System.Drawing.Color.Green

renders as
<span id="theAnswer"
style="color:Yellow;background-color:Green;">Label</span>

Is there a stylesheet or something that is getting in the way?

Ken

"tshad" <ts**********@ftsolutions.com> wrote in message
news:ez**************@TK2MSFTNGP14.phx.gbl...
Why doesn't BackColor on a label work (ForeColor works):

Dim theAnswer as Label
theAnswer.ForeColor = System.Drawing.Color.yellow
theAnswer.BackColor = System.Drawing.Color.green

BackColor on DataGridItem works fine.

Dim oGridItem as DataGridItem
oGridItem.BackColor = System.Drawing.Color.green

Thanks,

Tom


Nov 19 '05 #2
"Ken Cox [Microsoft MVP]" <BA************@sympatico.ca> wrote in message
news:O1**************@tk2msftngp13.phx.gbl...
It works here...

theAnswer.ForeColor = System.Drawing.Color.Yellow
theAnswer.BackColor = System.Drawing.Color.Green

renders as
<span id="theAnswer"
style="color:Yellow;background-color:Green;">Label</span>

Is there a stylesheet or something that is getting in the way?
That is possible. There is a style sheet. I will need to spend some time
trying to get it to work by backing out parts of the stylesheet.

Thanks,

Tom
Ken

"tshad" <ts**********@ftsolutions.com> wrote in message
news:ez**************@TK2MSFTNGP14.phx.gbl...
Why doesn't BackColor on a label work (ForeColor works):

Dim theAnswer as Label
theAnswer.ForeColor = System.Drawing.Color.yellow
theAnswer.BackColor = System.Drawing.Color.green

BackColor on DataGridItem works fine.

Dim oGridItem as DataGridItem
oGridItem.BackColor = System.Drawing.Color.green

Thanks,

Tom

Nov 19 '05 #3
Tom, the style sheet shouldn't override the node's style. Before you spend
time dismembering your css, take a look at the generated HTML for your page
to see if your color setting is getting rendered.

If not, there's likely a bug in your code that some basic breakpoints and
tracing can locate quickly.

/// M


"tshad" <ts**********@ftsolutions.com> wrote in message
news:#u**************@TK2MSFTNGP12.phx.gbl...
"Ken Cox [Microsoft MVP]" <BA************@sympatico.ca> wrote in message
news:O1**************@tk2msftngp13.phx.gbl...
It works here...

theAnswer.ForeColor = System.Drawing.Color.Yellow
theAnswer.BackColor = System.Drawing.Color.Green

renders as
<span id="theAnswer"
style="color:Yellow;background-color:Green;">Label</span>

Is there a stylesheet or something that is getting in the way?


That is possible. There is a style sheet. I will need to spend some time
trying to get it to work by backing out parts of the stylesheet.

Thanks,

Tom

Ken

"tshad" <ts**********@ftsolutions.com> wrote in message
news:ez**************@TK2MSFTNGP14.phx.gbl...
Why doesn't BackColor on a label work (ForeColor works):

Dim theAnswer as Label
theAnswer.ForeColor = System.Drawing.Color.yellow
theAnswer.BackColor = System.Drawing.Color.green

BackColor on DataGridItem works fine.

Dim oGridItem as DataGridItem
oGridItem.BackColor = System.Drawing.Color.green

Thanks,

Tom


Nov 19 '05 #4

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

Similar topics

4
by: Dave | last post by:
Hi, Can anyone tell me the correct syntax when using a variable to control the color property? This works ok: If ABC2flash Then Label61.BackColor = Color.Yellow This doesn't, showing...
3
by: Serious_Practitioner | last post by:
Hello, all - I would like to produce Avery labels, #5931, from a database I've built for a client. I can't seem to find this Avery number in the list of labels that pops up when one uses the...
3
by: OutdoorGuy | last post by:
Greetings, I have a very "novice" question to ask, so hopefully it will be easy. At any rate, I have a label on a Windows form called "label1". I simply want to change the "backcolor" property...
4
by: Brent | last post by:
It's curious. In my page the code ... TextBox t = (TextBox)Page.FindControl(mycontrol); if (!(t==null)) { t.Visible = false; } ....will hide the control. But the code...
1
by: Chris | last post by:
Hi, I am trying to set a row backcolor based on the value of a cell in my datagrid but it's not working This is what I have Private Sub grdProcessingTitles_ItemDataBound(ByVal sender As...
9
by: Jim | last post by:
Hi folks! I'm new to this forum. I've programmed in VB starting w/VB1 about 9 years ago! ;) Certainly most time spent in VB6. Now trying to make the leap to VB.NET. Much harder than I...
1
by: t perkins | last post by:
would there be a reason why i cannot set the backcolor on lables to be transparent. it is set to be transparent, but it does not work for some reason. any help would be greatly appreciated ...
3
by: vul | last post by:
I used to use creating headers (label at the top of the screen) for VB6 forms as 2 labels shifted a little bit with different for colors to get a simulation of a shadow. I set BackColor of both...
6
by: Dmitry Duginov | last post by:
Hi, I have the following label markup (label is inside FormView): <asp:Label ID="lblIndicatorReady" runat="server" Text="RE" ToolTip="Ready" BackColor='<%#...
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
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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.