Simple how to enable a Textbox which is disabled by clicking on it? how is this done?
my code doesn't work
Private Sub Textbox1_MouseClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Textbox1.MouseClick
Textbox1.Enabled = True
End Sub
Can anyone help me out.
Do I have to resort to tracking the mouse clicks and X,Y positions of textbox with timers etc.. no events are fired from clicking it?
What worked for me seems like the best way to go is to do something like this.
and to disable it run this kind of code
But first set the color to disabled I found that using ButtonFace color probably works best, it sure looks real.
my intention was never to disable it, but to make the user think it's disabled until he clicks it.. when he clicks somewhere else it turns disabled
As an alternative, you can set the ReadOnly control property to True and the Text property to "" when a MouseClick event reach another control (another TextBox for example).
That work fine for me. My code is:
You can use IMessageFilter to trap WM_LBUTTONDOWN messages and then check to see if the cursor is within the TextBox...something like:
When your text box is in the
enabled = false
state you cant click on it with a mouse.