| || |
Join Date: Apr 2008
Re: How to lock a textbox need property through code.
You can do 2 things, you can set the locked property to false or you can enable the textbox. The difference? When you lock a textbox you CAN select the text but you CAN'T modify it, when you disable a textbox it grays out so you are not to be able to select it nor modify it. If you're to lock it you'll need to set the Locked property to True (by default it's set to True), but if you're to disable it you'll need to set the enabled property to false. You can do that by selecting the textbox3 in your form and look for the enable property in your properties table.
Here's how your code can be:
Private sub txtbox2_Change()
'The sub txt1box2_Change will be triggered each time you write on the TextBox2
If txtbox2.text = "aaa" and txtbox3.text = "123" then 'there's your condition
txtbox3.locked = false
'txtbox3.enabled = true 'use this if you want to do disable it insted of lock it