Keeping focus off text boxes.

Joshb

New member
Joined
Jan 8, 2008
Messages
3
Programming Experience
5-10
Hi. I wondering how to accomplish a small task i'm in need for.


What i have is a Form and a text box control that is disabled. I have my code on the form_keypress to send characters to the disabled text box. This part works fine, my problem is i have another text box thats not disabled but locked, so it takes focus. Doing that i can't set the form to focus without disabling the second text box instead of locking it.


basically... how to i keep focus from text boxes without disabling them?
 
VB.NET:
Me.TextBox2.TabStop = False

or you can do the same through the design view and properties window.
Just set up the property TabStop to false. Voila!
 
If you don't want the user to edit the text in the textbox and you don't want the textbox to be disabled

set the textbox's readonly property to true
 
The above works but forces the focus to the next text box. Even if they both have a tabstop of true. I'll explain what i'm trying to create here...


I'm wanting to simulate a console. I'm using a RichTextbox control for the console. However you don't type commands directly in the console box, but rather another textbox for entering commands. The reason i don't want focus on the textbox is to get rid of the goody "|" blinking when it has focus. Maybe there's something else i should be doing?
 
Personally, I would set the RichTextbox's ReadOnly property to True (so they can't edit it) and I wouldn't worry about the cursor caret, the caret's used to coping text (which you may want to allow the user to do this)
 
Back
Top