How can I make text in a box print in a limited area.


I have  a text box, I need the user to be able to enter data. When it is printed after so many characters I need the text to appear on the next line. Anyone any ideas?
Who is Participating?
Maybe try something like this:

Private Const max_letters As Integer = 10

Private Sub Text1_Change()
Static numLetters As Integer

numLetters = numLetters + 1
If numLetters = max_letters Then
    Text1.Text = Text1.Text & vbCrLf
    Text1.SelStart = Len(Text1.Text)
    numLetters = 0
End If
End Sub
eneateAuthor Commented:

Thanks it works. Just one query, I am printing the text to a label, how can I ensur ethat for each new line the position of the line is currentx = 200
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.