Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Enabling & Disabling a text box

Status
Not open for further replies.

mark01

Technical User
Jan 17, 2001
600
US
Just wondering how the code will look for Enabling & Disabling a text box on a Form. For example, I need enable text1 on form1 when I click a checkbox.

Thx

 
Try this.....

sub check1_click

if ckeck1.value=1 then 'the check box is ticked
textbox1.enabled=true
else textbox1.enabled=false

end sub

Hope it helps

BB
 
also change the background color...

textbox1.enabled=false
textbox1.BackColor = &H8000000B

--
Luis MX
 
Thank you very much!! Works beautifully. :)
 
>>
sub check1_click

if ckeck1.value=1 then 'the check box is ticked
textbox1.enabled=true
else textbox1.enabled=false

end sub


Can be recoded to be a bit simpler (although a TINY bit...):

sub check1_click

textbox1.enabled=CBool(check1.Value)

end sub


Greetings,
Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top