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

Posted on 2006-06-08
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

    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


    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

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Suggested Solutions

    I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
    Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

    755 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now