Hello there,
I have attmpted a For To Next Loop and a Do While Not Loop to add all the items from my list box.
Here's a look at both loops.
1)
VB Code:
Private Sub List0_DblClick(Cancel As Integer) Dim s As Integer For s = 0 To List0.ListCount List1.AddItem List0.ItemData(s) Next s End Sub
This loop adds item as desired but prompts an error message at the end.
Run-time error 94 Invalid use of Null.
2)
VB Code:
Private Sub List0_DblClick(Cancel As Integer) Dim i As Integer i = List0.ListCount Do While Not i = 0 i = i - 1 List1.AddItem List0.ItemData(i) Looo End Sub
This loop adds item from bottom to top since it starts from ListCount's value and - 1.
I'll like to have my items added the correct way without the error, can anyone comment on my loops and give suggestions?
will be more than glad to learn new ways of looping.
Thank You
Astro




Reply With Quote