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

Posted on 2006-06-08
Medium Priority
Last Modified: 2010-04-30

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?
Question by:eneate
LVL 19

Accepted Solution

BrianGEFF719 earned 1000 total points
ID: 16864531
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

Author Comment

ID: 16865986

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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month9 days, 7 hours left to enroll

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question