I need to lock an textbox. I've tried to use .enabled=false but it dimmed textbox. How can i achieve it?
Printable View
I need to lock an textbox. I've tried to use .enabled=false but it dimmed textbox. How can i achieve it?
umm it;s not a good idea to disable it
set the ReadOnly property to True, and if you want the back color to be white then change the BackColor property to white
Yes, but there's two problems. First, control can still be focused. Second, forecolor cannot be normalized.
private sub textbox_Change(byval blah blah blah............)
if text1.text <> "whatever you want it to say" then
text1.text = "whatever you want it to say"
end if
end sub
try that... under the change (or somethin like that) thing
Private Sub text1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles text1.TextChanged
If text1.Text <> "Whatever" Then
text1.Text = "Whatever"
End If
End Sub
try that, that way they can still highlight it and copy/cut or whatever but if its ever changed, then it reverts back like .00000000000000000000001 miliseconds later :D
hope this helps
Hi
In VB the desire results could be obtained by placing the text box
in a frame. setting the frame border to none, so that it can not be seen. if you now set the frame enabled property to false, none of the controls in the frame are now accessable,
textbox is completely disabled from user selection or input, but looks the same
i use this all the time for enabling and disabling groups of controls
Si
:) ;) :eek: