Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tab behvior in memo or text box

Status
Not open for further replies.

cfrut

IS-IT--Management
Jun 4, 2003
2
US
I'm looking for a way to make the tab key really do a tab instead of jumping to the next control on the form.
I want to use a large text box or a memo to have several
lines of text, and would like the ability to tab in.
I'm currently using an embeded Word doc. but would rather
use a memo or text box.
thanks for any ideas.
 
Text boxes (there's no such thing as a "memo" box) don't support tab stops. You might look into using a RichText control, if you have a developer edition of Access (at least I think it's included in the developer edition).

Another thing you could do is simulate tab stops using VBA code. You'd use the text box's KeyPress event to capture the Tab keystroke. You'd need to use a monospaced font such as Courier New, so that you have a fixed number of characters per line. Then the expression TextBox.SelStart Mod (characters per line) gives you the cursor column number (zero-relative). From that you can compute the number of spaces to insert in order to position to the next tab stop.

There are complications, though. If the cursor is not at the end of the text, inserting spaces will disturb the positioning of all subsequent text. And if the user has selected text, your spaces should replace the selection rather than being inserted, which also disturbs subsequent text.

Rick Sprague
Want the best answers? See faq181-2886
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top