How to print the string values line by line ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • santhanalakshmi
    New Member
    • May 2009
    • 147

    #1

    How to print the string values line by line ?

    Hi,

    I am opening the "text file" and writing in that text file using VB.

    For example:

    Code:
    mystring="Hi,how are you?,fine"
    
    'writing in text file
             
    print #1; "Name";tab(25);"Location";tab(40);"Description";tab(60);"Designation"
    print #1;rs!name;tab(25);rs!location;tab(40);[B]mystring[/B];tab(60);rs!designation
    my output is:
    xxx chennai Hi,how are you?,fine manager



    But i don't need like as above output.

    I need output like this:

    xxx chennai 1. Hi Manager
    2. how are you?
    3. fine


    I want to print the description in vertically by splitting with comma delimited.

    Please help me out and give me some idea to solve this problem. Thanks in advance
  • Guido Geurs
    Recognized Expert Contributor
    • Oct 2009
    • 767

    #2
    You can split strings into an array by a delimitor like "," with the command Split(string,de limitor).
    This split Mytext and prints it in an textbox:

    Code:
    Private Sub Command1_Click()
    Dim mystring As String
    Dim ARRSPLIT() As String
    Dim ARRSPLITidx As Integer
       mystring = "Hi,how are you?,fine"
       ARRSPLIT = Split(mystring, ",")
       For ARRSPLITidx = LBound(ARRSPLIT) To UBound(ARRSPLIT)
          Text1.Text = Text1.Text & ARRSPLIT(ARRSPLITidx) & vbNewLine
       Next
    End Sub

    Comment

    Working...