473,320 Members | 2,193 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.

Enable/Disable Labels

Tom
Hi:

When you disable a text box you get the "ghost effect" on the
associated label control. How can you mimic that same effect on a
label not associated with a text box?

Basically, the setup I have is:

lblControlName txtControl lblUnit

Where:
lblControlName is the title of the control (e.g., "Density")
txtControl is the value (e.g., 8.34)
lblUnit is the unit for the control (e.g., "lbs/gal")

For certain records I need to disable txtControl because I don't what
the user entering data. When I set enabled = false for txtControl,
lblControlName also goes to ghost. However, lblUnit doesn't and it
looks funny. How do I get it to mimic the ghost effect?

Thanks
Tom

Dec 20 '06 #1
4 9589
MLH
Faced with the same dilemma in the past, I have resorted to
setting the label's Foreground and Background properties to
the colors in which the 'grayed out' text boxes are displayed
in. I seem to remember launching a discusion on that topic
on this NG a good while back and that was the best that
turned up.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx
On 20 Dec 2006 08:59:25 -0800, "Tom" <rt*****@swbell.netwrote:
>Hi:

When you disable a text box you get the "ghost effect" on the
associated label control. How can you mimic that same effect on a
label not associated with a text box?

Basically, the setup I have is:

lblControlName txtControl lblUnit

Where:
lblControlName is the title of the control (e.g., "Density")
txtControl is the value (e.g., 8.34)
lblUnit is the unit for the control (e.g., "lbs/gal")

For certain records I need to disable txtControl because I don't what
the user entering data. When I set enabled = false for txtControl,
lblControlName also goes to ghost. However, lblUnit doesn't and it
looks funny. How do I get it to mimic the ghost effect?

Thanks
Tom
Dec 20 '06 #2
Tom, this isn't a very elegant solution, but it works: you can make one long
label that contains both the control name and the units, with a big gap in
the middle that you cover up with the textbox. If this long label is
associated with the textbox, the whole thing will grey out when you disable
the textbox.
-John

"Tom" <rt*****@swbell.netwrote in message
news:11**********************@80g2000cwy.googlegro ups.com...
Hi:

When you disable a text box you get the "ghost effect" on the
associated label control. How can you mimic that same effect on a
label not associated with a text box?

Basically, the setup I have is:

lblControlName txtControl lblUnit

Where:
lblControlName is the title of the control (e.g., "Density")
txtControl is the value (e.g., 8.34)
lblUnit is the unit for the control (e.g., "lbs/gal")

For certain records I need to disable txtControl because I don't what
the user entering data. When I set enabled = false for txtControl,
lblControlName also goes to ghost. However, lblUnit doesn't and it
looks funny. How do I get it to mimic the ghost effect?

Thanks
Tom

Dec 20 '06 #3
Another approach is to associate the label with an unbound textbox.
Set the textbox width to 0, special effect to flat, border and
background to transparent, and tab stop to 'no'. The textbox will be
effectively hidden at that point and its associated label can be
'disabled' by disabling the textbox.

Bruce

Dec 20 '06 #4
Tom
Thanks to all 3 of you for your thoughts. It seems like there are a
few work arounds, but no elegant solutions. <sigh>.

Bruce - I think I like your solution the best, it seems to be the one
least likely to have unexpected problems crop up at a later date.

Tom
de***************@gmail.com wrote:
Another approach is to associate the label with an unbound textbox.
Set the textbox width to 0, special effect to flat, border and
background to transparent, and tab stop to 'no'. The textbox will be
effectively hidden at that point and its associated label can be
'disabled' by disabling the textbox.

Bruce
Dec 20 '06 #5

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

Similar topics

3
by: Alphonse Giambrone | last post by:
I am trying to enable/disable a requiredfieldvalidator on the client side and am generating an error. I had found some documentation on validation which states that I should be able to...
3
by: DBQueen | last post by:
I have a form with lines of controls. On some of the lines there are 3 controls (call them A,B,C); other lines have only control A. The controls have been numbered sequentially (Q20, Q21....Q76)...
0
by: talal | last post by:
How to check whether javascript is enable or disable in client browser. Remeber i can check wheter browser client support javascript with BrowserCapability class. But what if the client has disable...
4
by: mabond | last post by:
Does anyone know some code that will allow me to enable and/or disable a task which already exists in the task scheduer. I have a task which runs at 15 min intervals and from time to time I want to...
2
by: RootSpy2006 | last post by:
Hi All, Problem Definition: --------------------- Microsoft Wirelss Keyboard works in BIOS but does not work when booting into windows. Discovered Work-around: -----------------------------...
8
by: rongchaua | last post by:
Hi all, i would like now to disable and enable network adapter programmatically with c#. I have searched but found nothing useful. There's no topic about this problem. Has someone done with this...
3
by: Pietro | last post by:
Hi all, First of all I'd like to thank you very very much ,as finally after many years of searching,I could find a code to disable/enable the shift key,but actually i cannot use the code as I'm...
2
by: Naushad | last post by:
Hi all, I am using the countinous form. I want to Enable/Disable the some fields for perticular records as per the following condition when open the form. I have written this code in "On Current...
10
by: viki1967 | last post by:
Disable/enable icon.gif Hi all. I have this form in the page.htm: <form action="form.asp" method="post" onsubmit="return(validateForm(this));"> <select size="1" name="t_im"...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: 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)...
0
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...
0
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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.