Array to a textbox - VB 6

Hello-

I need to dump the contents of an array into a textbox (as a report). I am a beginner and cannot figure it out. Any examples would be much appreciated.

Thanks-

Comments

  • Does it have to be a text box? A picture box would be a lot easier using a for ... next block.
    You should already know the bounds of the array, starting at 0 or 1 and ending at the last entry. For example lets say it's from 1 to 40:

    For i = 1 to 40
    picBox.Print array(i)
    Next i

    Will Display each of the items on a separate line

    If it must be a text box I guess this will work:

    For i = 1 to 40
    txtBox.text = txtBox.text & Chr(032) & array(i)
    Next i

    This would add each componant of the array to the prevoius one, kinda making for 1 long sentence. (the Chr032 adds a blank space between them and can be omitted if you like).

    Again I suggest the picture box, it's easier. If you go with the text box be sure to set the word wrap (or multiple line or something to that effect) to true.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion