Don't allow typing after text property

tredpath

New member
Joined
Aug 26, 2005
Messages
1
Programming Experience
Beginner
I've got a text box set up with a text property of Resolution:

I do not want the user to be able to edit the word Resolution, but start typing afterward. Would someone be able to help me with the code?
 
It sounds to me like you should probably be using a Label with its Text set to "Resolution:" rather than having it as part of the TextBox contents.

If you really need it in the TextBox, in the KeyPress event handler you will need to check that the user is typing a character and if the cursor is located within the word "Resolution". The curosr position can be found using the SelectionStart property. Then you would set e.Handled to True if you wanted to reject the character.
 
Back
Top