Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filling Listboxes using arrays

Status
Not open for further replies.

InfiniteLives

Programmer
Dec 29, 1999
2
GB
Forgive me if I do not use the right terms, but I hope I put across enough<br>
information.<br>
<br>
I have an array that stores a name and then a number, e.g.<br>
<br>
0,0 and 0,1 hold, &quot;NAME&quot; and 100 respectively. I got this information from<br>
a textbox on the screen.<br>
<br>
I can get it into the array fine, but when I want to get it from the array<br>
to a listbox that is a problem.<br>
<br>
I want the name and number in two columns in the list box. I have changed<br>
the column property to more than one, but still end up with the data in one<br>
column.<br>
<br>
This is a college assignment, so I can't change things to drastically.<br>
<br>
Please help anyone.<br>
<br>
(VB5 by the way)<br>
<br>
Thanks<br>
<br>

 
This should work if I'm understanding what your looking for:<br>
Dim MySet(4, 4) As String<br>
Dim i As Integer<br>
<br>
MySet(0, 0) = &quot;1&quot;<br>
MySet(1, 0) = &quot;First&quot;<br>
MySet(0, 1) = &quot;2&quot;<br>
MySet(1, 1) = &quot;Second&quot;<br>
MySet(0, 2) = &quot;3&quot;<br>
MySet(1, 2) = &quot;Third&quot;<br>
MySet(0, 3) = &quot;4&quot;<br>
MySet(1, 3) = &quot;Fourth&quot;<br>
MySet(0, 4) = &quot;5&quot;<br>
MySet(1, 4) = &quot;Fifth&quot;<br>
<br>
For i = 0 To 4<br>
List1.AddItem MySet(0, i) & &quot; &quot; & MySet(1, i)<br>
Next i
 
try using vbTab instead if the space in the middle<br>
-ml <p>Mike Lacey<br><a href=mailto:Mike_Lacey@Cargill.Com>Mike_Lacey@Cargill.Com</a><br><a href= Cargill's Corporate Web Site</a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top