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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

enter key as return

Status
Not open for further replies.

lalee5

Technical User
Oct 20, 2002
70
US
how do i code when user press enter key to act as return key when entering text into textbox?

kay lo
 
Not exactly sure what you're looking for but, if you want the cursor to move to the next line then change the textbox's Multiline property to True . If you want to be able to tab from control to control by hitting the enter key then place something like this in the Keypress event of your textbox.

If KeyAscii = 13 Then
SendKeys "{TAB}"
KeyAscii = 0
end if
 
Lalee5,

I think what you may be experiencing is that the Enter key does not move to the next line in your text box, even when it is set to multiline.

You should be aware that if you have a command button on your form that is set to the default button, then this will override the carriage return in your textboxes... You have 2 options.

1. Set the default property of your command buttons to False

2. Use CTRL + ENTER or SHIFT + ENTER key combinations in your textboxes to move to the next line.

Hope this helps,



jgjge3.gif


[tt]"Do not put off until tomorrow what you cannot put off until the day after tomorrow just as well." - Mark Twain[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top