carriage return in textbox

D

DracKewl

In my VBA app I got a big textbox, and need it so that when a user hits the
return key a carriage return happens, and let the user keep typing. This is
driving me nuts! It happens fast but I can see the carriage return happen
but cursor goes back to the last position of the string.

Here is my code

Private Sub ProjectsNotes_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = 13 Then
ProjectsNotes.Text = ProjectsNotes.Text + vbCrLf
ProjectsNotes.SelStart = Len(ProjectsNotes.Text)
ProjectsNotes.SelLength = 0
KeyCode = 0 'I added this so I keep focus.
End If
 
D

DracKewl

Once again I submit a stupid question and figure it out 30 secs later. For
those that need an answer.

The textbox has a property called "Enter Key Behaviour" and is set to
default, change it to "New Line in Field" and no coding will be neccessary.

#$%#$%
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top