473,587 Members | 2,509 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

BackColor on Label doesn't seem to work

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

Dim theAnswer as Label
theAnswer.ForeC olor = System.Drawing. Color.yellow
theAnswer.BackC olor = System.Drawing. Color.green

BackColor on DataGridItem works fine.

Dim oGridItem as DataGridItem
oGridItem.BackC olor = System.Drawing. Color.green

Thanks,

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

theAnswer.ForeC olor = System.Drawing. Color.Yellow
theAnswer.BackC olor = System.Drawing. Color.Green

renders as
<span id="theAnswer"
style="color:Ye llow;background-color:Green;">L abel</span>

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

Ken

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

Dim theAnswer as Label
theAnswer.ForeC olor = System.Drawing. Color.yellow
theAnswer.BackC olor = System.Drawing. Color.green

BackColor on DataGridItem works fine.

Dim oGridItem as DataGridItem
oGridItem.BackC olor = System.Drawing. Color.green

Thanks,

Tom


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

theAnswer.ForeC olor = System.Drawing. Color.Yellow
theAnswer.BackC olor = System.Drawing. Color.Green

renders as
<span id="theAnswer"
style="color:Ye llow;background-color:Green;">L abel</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**********@f tsolutions.com> wrote in message
news:ez******** ******@TK2MSFTN GP14.phx.gbl...
Why doesn't BackColor on a label work (ForeColor works):

Dim theAnswer as Label
theAnswer.ForeC olor = System.Drawing. Color.yellow
theAnswer.BackC olor = System.Drawing. Color.green

BackColor on DataGridItem works fine.

Dim oGridItem as DataGridItem
oGridItem.BackC olor = 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**********@f tsolutions.com> wrote in message
news:#u******** ******@TK2MSFTN GP12.phx.gbl...
"Ken Cox [Microsoft MVP]" <BA************ @sympatico.ca> wrote in message
news:O1******** ******@tk2msftn gp13.phx.gbl...
It works here...

theAnswer.ForeC olor = System.Drawing. Color.Yellow
theAnswer.BackC olor = System.Drawing. Color.Green

renders as
<span id="theAnswer"
style="color:Ye llow;background-color:Green;">L abel</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**********@f tsolutions.com> wrote in message
news:ez******** ******@TK2MSFTN GP14.phx.gbl...
Why doesn't BackColor on a label work (ForeColor works):

Dim theAnswer as Label
theAnswer.ForeC olor = System.Drawing. Color.yellow
theAnswer.BackC olor = System.Drawing. Color.green

BackColor on DataGridItem works fine.

Dim oGridItem as DataGridItem
oGridItem.BackC olor = 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
17209
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 syntax error in source code: Dim ABC1col As String = "Color.Yellow"
3
5795
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 label wizard. This is a label for CD and DVD media - Word 2002 has the template built in, but Access 2002 doesn't seem to. Does this mean I have to use a "mail-merge" type activity, or can I get Access to use the Word template somehow?
3
18881
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 to a different color (e.g., "blue"), but I haven't figured out how to do it. I want to do this when the user clicks a button. Any ideas? Thanks in advance!
4
6671
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
1701
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 Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles grdPro.ItemDataBound
9
3472
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 thought it would be. For now, I need to know how to change the foreground and background colors on labels and buttons. I used to be able to do this in VB6 but cannot seem to get it to work in VB.NET. Any suggestions will be greatly appreciated!
1
1415
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 tony
3
3957
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 labels to Transparent. Everything works fine. I'm trying to use the same approach with VB 2005 windows forms. Although I'm setting labels backcolors to transparent, it is not transparent and the label located behind is not visible. I tried to...
6
2896
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='<%# Eval("Ready").ToString()=="True"?System.Drawing.Color.FromName("#FFFF80"):System.Drawing.Color.White %>' Enabled='<%# Eval("Ready") %>'
0
8216
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
7974
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8221
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5719
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3845
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2364
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.