473,467 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Disabled Label but change forecolor

1 New Member
Is there a way to change the forecolor of a disabled label??
Im have an image button then a transparent label with text above it. I can't click the button if the label is enabled, so I disabled the label but the text (or the caption) on the label is grayed out. Can I change that forecolor?? please help. Tnx Tnx Tnx!!
Jun 24 '11 #1
1 2936
Guido Geurs
767 Recognized Expert Contributor
I don't think it's possible to change the forecolor for disabled label.
A possibility is to work with 2 labels on the same place and with the same dimensions:
label1 with index 0 to receive the clicks
label1 with index 1 (with your disable color) to be visible if label1(0) is disabled

Use the "Visible" status in stead of "Enable" for the Label1(0)
Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2.  
  3. Private Sub Form_Load()
  4.    With Label1(0) '§ click
  5.       .Visible = True
  6.    End With
  7.    With Label1(1) '§ show with disable color
  8.       .Visible = False
  9.       .Top = Label1(0).Top
  10.       .Left = Label1(0).Left
  11.       .Width = Label1(0).Width
  12.       .Height = Label1(0).Height
  13.    End With
  14. End Sub
  15.  
  16. Private Sub Com_Disable_Click()
  17.    Label1(0).Visible = False
  18.    Label1(1).Visible = True
  19. End Sub
  20.  
  21. Private Sub Com_Enable_Click()
  22.    Label1(0).Visible = True
  23.    Label1(1).Visible = False
  24. End Sub
  25.  
  26. Private Sub Label1_Click(Index As Integer)
  27.    If Index = 0 Then
  28.       With Label1(0)
  29.          .Caption = Val(.Caption) + 1
  30.          Label1(1).Caption = .Caption
  31.       End With
  32.    End If
  33. End Sub
Attached Files
File Type: zip Disabled Label but change forecolor_v1.zip (1.8 KB, 87 views)
Jun 28 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Eric Robishaw | last post by:
I'm adding items to a CheckBoxList Control, and need the text in each checkbox list item to be a specific color. Here's what I'm trying: ListItem li = new ListItem(GroupName, GroupID);...
2
by: Dot net work | last post by:
Hello. I have an aspx page that changes an HTML label's text using javascript. After the label's text has been changed in this way, I redirect to another aspx page. If I then use the back...
1
by: Jim | last post by:
Hey all, I'm trying to change the forecolor of asp.net textbox text as I mouse over them. I keep getting a javascript error that the item doesn't exist when trying to reference it by it's ID. Any...
1
by: mail2madhur | last post by:
I need to display different text on label on click of button. <table> <tr> <td> ?????</td> </tr> <tr> <td> <TEXTAREA id="notesId" name="notesdescDisplay" rows=12 cols=83 value=""></TEXTAREA>...
2
by: bonokoot | last post by:
Hello, I have a MasterPage with a Label that I want to display a custom description of the page and when the user clicks to different links on my website I would like that description to change....
0
by: getnanda | last post by:
I have a TreeView control with more than 10000 TreeNodes in it. I have to update the text property of the each TreeNode. With c# we are using foreach loop to iterate through the TreeNodes and to...
1
by: signzala | last post by:
i working on widndows application. I want to change forecolor of all cells in row for specific condition. can anybody help me how to do this ?
1
by: gurpreetintown | last post by:
How to change the fore color of a disabled combo box in runtime? platform - c#.net
4
by: TD | last post by:
I am trying to change the forecolor of a field in a subform that is in datasheet view. I am using Access 2007. I have tried everything I can think of to do this but the text still appears in...
1
by: Joel1334 | last post by:
Hi! How can I change forecolor of a selected value in combobox? when I select a value in a combobox and press a button to "activate" what I've selected I want the text to be green and then...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
1
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
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 ...

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.