![]() |
Qn: Checkbox Enable??
Hello Everyone,
I have an checkbox option in my userform. How do I get it to blank or GRAY out a TextBox area when the box is checked?? I saw a sample of how to UNBLANK a textbox with the enable feature, but I need the opposite. What is the opposite of enable? a.. 1.. Insert the following statement as the body of the new chkMonth_Click procedu b.. txtMonth.Enabled = chkMonth.Value c.. This statement will enable the text box whenever the check box is selected, and disable the text box whenever the check box is cleared. |
Checkbox Enable??
Enable is either true or false. The opposite of enabled = True is enabled =
False you item b seems to do that already. If you want it to operate opposite of the checkbox status then txtMonth.Enabled = not chkMonth.Value -- Regards, Tom Ogilvy "Michael Vaughan" wrote in message ... Hello Everyone, I have an checkbox option in my userform. How do I get it to blank or GRAY out a TextBox area when the box is checked?? I saw a sample of how to UNBLANK a textbox with the enable feature, but I need the opposite. What is the opposite of enable? a.. 1.. Insert the following statement as the body of the new chkMonth_Click procedu b.. txtMonth.Enabled = chkMonth.Value c.. This statement will enable the text box whenever the check box is selected, and disable the text box whenever the check box is cleared. |
Checkbox Enable??
Hi Tom,
Well, I put in the "txtMonth.Enabled = not chkMonth.Value" and the chkMonth Box does NOT gray out when I check the box. Am I doing something wrong?? I want an input box of txtMonth to gray out when I check the checkbox chkMonth. Thanks for all your help... mv "Tom Ogilvy" wrote in message ... Enable is either true or false. The opposite of enabled = True is enabled = False you item b seems to do that already. If you want it to operate opposite of the checkbox status then txtMonth.Enabled = not chkMonth.Value -- Regards, Tom Ogilvy "Michael Vaughan" wrote in message ... Hello Everyone, I have an checkbox option in my userform. How do I get it to blank or GRAY out a TextBox area when the box is checked?? I saw a sample of how to UNBLANK a textbox with the enable feature, but I need the opposite. What is the opposite of enable? a.. 1.. Insert the following statement as the body of the new chkMonth_Click procedu b.. txtMonth.Enabled = chkMonth.Value c.. This statement will enable the text box whenever the check box is selected, and disable the text box whenever the check box is cleared. |
Checkbox Enable??
Private Sub CheckBox1_Click()
TextBox1.Enabled = Not CheckBox1.Value End Sub worked fine for me. There was no visible change to the textbox, but I couldn't enter the textbox and enter a value when the checkbox was checked. Are you using ActiveX controls or controls from the forms toolbar? If activeX, you can get some visual feedback with Private Sub CheckBox1_Click() TextBox1.Enabled = Not CheckBox1.Value If CheckBox1.Value Then TextBox1.SpecialEffect = fmSpecialEffectFlat Else TextBox1.SpecialEffect = fmSpecialEffectSunken End If End Sub or you can set the backcolor to gray. -- Regards, Tom Ogilvy "Michael Vaughan" wrote in message ... Hi Tom, Well, I put in the "txtMonth.Enabled = not chkMonth.Value" and the chkMonth Box does NOT gray out when I check the box. Am I doing something wrong?? I want an input box of txtMonth to gray out when I check the checkbox chkMonth. Thanks for all your help... mv "Tom Ogilvy" wrote in message ... Enable is either true or false. The opposite of enabled = True is enabled = False you item b seems to do that already. If you want it to operate opposite of the checkbox status then txtMonth.Enabled = not chkMonth.Value -- Regards, Tom Ogilvy "Michael Vaughan" wrote in message ... Hello Everyone, I have an checkbox option in my userform. How do I get it to blank or GRAY out a TextBox area when the box is checked?? I saw a sample of how to UNBLANK a textbox with the enable feature, but I need the opposite. What is the opposite of enable? a.. 1.. Insert the following statement as the body of the new chkMonth_Click procedu b.. txtMonth.Enabled = chkMonth.Value c.. This statement will enable the text box whenever the check box is selected, and disable the text box whenever the check box is cleared. |
All times are GMT +1. The time now is 12:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com