I am new to VB, and I am trying to add data to an array from a textbox and have the data display in a listbox on a different form.
Can any body give me some generic examples. Thank you in advance for your time.

JLJ

What is the event you want to use to move the data? Keypress? Buttonclick? Why do you want to move data into an array before moving it into a listbox? What code do you have sofar?

I think that you are trying to add information from textbox to an array and display it to listbox in another form.
if this is the case, then
you need to define array in a Module so that it is visible to all forms.
Then you can add text from textbox to the array, say after clicking a button.
But you must also keep track of number of elements in the array. If it is not known in advance, you can keep increasing the number every time a new element is added.
So if num is variable that stores the number of elements of the array, you increment every time a new element is added to the array
num = num+1
Next time you add another element you must re-dimension the array
Redim(num)
so that the length of array gets incremented.
When you open the other form you can read the elements of the array and add to listbox as array is defined globally

If you just use: ReDim TheArray(num) you would loose all the values entered previously. To keep these you need to use: ReDim Preserve TheArray(num) where num can be num+1.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.