Reading Each line in string or text box

Posted on 2008-11-18
Last Modified: 2012-05-05
I have an application which uses a class to create pdf documents  from a text box. But the class required that each line should be inserted separately as:

  objpdf.PDFTextOut line, 1, 1
  objpdf.PDFTextOut "lin2", 1, 2
  objpdf.PDFTextOut "line 3", 1,3

If I use objpdf.PDFTextOut text1.text command now it reads only the first line of text1.text not the rest.

Now I want a mechanism which can read each line of text1.text.

Can any one help me in this regards

Question by:aib_it
    LVL 48

    Expert Comment

    >> Now I want a mechanism which can read each line of text1.text.
    Try this way:

            For Each line As String In Me.TextBox1.Lines

    Open in new window

    LVL 48

    Accepted Solution

    Opps! It's VB6

        Dim line As Variant
        Dim lines() As String
        lines = Split(Me.TextBox1.Text, vbNewLine)
        For Each line In lines
          Debug.Print line

    Open in new window


    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Open Report with Multiple Criteria 9 59
    VBA Modification 5 36
    Formula to Randomize Data Set for Time Series Visual 1 63
    Copy a row 12 32
    There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
    Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
    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…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    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

    16 Experts available now in Live!

    Get 1:1 Help Now