What is the code to lock a Textbox?
The following code throws an error:
The error is : 'Locked' is not a member of 'System.Windows.Forms.Text'Code:txtVNO.LOCKED = True
Then how to lock a textbox? Please advise.
Regards.
Printable View
What is the code to lock a Textbox?
The following code throws an error:
The error is : 'Locked' is not a member of 'System.Windows.Forms.Text'Code:txtVNO.LOCKED = True
Then how to lock a textbox? Please advise.
Regards.
Try:
Edit:Code:txtVNO.enabled = False;
If you are using the text box for output purposes try using a label instead.
How aboutCode:txtVNO.ReadOnly = True
txtVNO.Backcolor= Color.White
Locked is a property of controls for the designer, it has nothing to do with the controls at runtime (Locked simply means you can't move or resize a control in the designer with the mouse)
You either disable the TextBox (.Enabled = False) or, since it's a TextBox you use the ReadOnly property of which Hack has already shown an example. Though I wouldn't use static color as that it might not match the user's theme (color scheme) I would set the .BackColor = SystemColors.Window instead:Code:txtVNO.ReadOnly = True
txtVNO.Backcolor= SystemColors.Window