From the sounds of it you want a textbox to normally act like a label but under some conditions be edited by the user. This solution should work great for you. What I did was create a class that inherits the TextBox class. In every way it's just a textbox except for one, it doesn't go grey when disabled.
Public Class TextBox_NoDisabledLook
Inherits TextBox
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
'The message ID that tells the textbox to grey out when disabled
Const WM_ENABLE As Integer = &HA
'Exit if the message is WM_ENABLE, thus preventing the greyed out look
If m.Msg = WM_ENABLE Then Exit Sub
MyBase.WndProc(m)
End Sub
End Class
To add this control to your application just create a new class and replace the code with the code above. The control should appear in the tools list under "MyControls Components" which should be at the top. You may need to run your program once before the control appears in the list (That's what I always need to do anyway). At this point you can drag and drop the control on your form just like any other.
Now you can disable the textbox which will prevent it from getting focus but it will still have an enabled look. Just enable the textbox whenever you want to allow the user to edit it. I hope that helps with your problem.
Enter your message below
Sign in or Join us (it's free).