Results 1 to 4 of 4

Thread: How to print an array in Richtext box

  1. #1
    Contributing Member
    Join Date
    Apr 2007
    Answers
    41

    How to print an array in Richtext box

    Hi All,

    I want to print the elements of array in rich text box. And i want each element of array to be in new line.
    so i achieved tat with this piece of code
    In sub routine

    arr(0) = "Here"
    arr(1) = "Pencils"
    arr(2) = "String"
    RichTextBox1.Text = (arr(0) & vbCrLf & arr(1) & vbcrlf & arr(2))

    But if there are 100 elements, it will be too lengthy.
    So is there anyway that i can give the array address and it prints in new line.

    Say like RichTextBox1.Text = &arr

    or put in a if loop .???
    I tried it but could not make it,
    Can anyone help me please....??




  2. #2
    Contributing Member
    Join Date
    Feb 2007
    Answers
    34

    Re: How to print an array in Richtext box

    hey try to use varible and increment it.


  3. #3
    Contributing Member
    Join Date
    Apr 2007
    Answers
    41

    Re: How to print an array in Richtext box

    I tried like this

    For i = 0 To 3
    RichTextBox1.Text = (arr(i) & vbCrLf)
    i = i + 1
    Next

    But the values are overlapping
    Mean only last array element is getting printed


  4. #4
    Junior Member
    Join Date
    Dec 2007
    Answers
    12

    Re: How to print an array in Richtext box

    hye just a small change in ur code reqd...

    For i = 0 To 3
    RichTextBox1.Text = RichTextBox1.Text & arr(i) & vbCrLf
    i = i + 1
    Next


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact