Using DIR() I got all the files that end with .mp3 (for example) show up in a listbox. How would I loop through the listbox now, checking the first letter of each file? And how would I do it with a comboBox?
Printable View
Using DIR() I got all the files that end with .mp3 (for example) show up in a listbox. How would I loop through the listbox now, checking the first letter of each file? And how would I do it with a comboBox?
something like:
VB Code:
For ctr = 0 To List1.ListCount MsgBox List1.List(ctr) If Left(List1.List(ctr),1) = "A" then MsgBox ctr End if Next
Thanks
I think youll need -1 too, like:Quote:
Originally posted by JordanChris
something like:
VB Code:
For ctr = 0 To List1.ListCount MsgBox List1.List(ctr) If Left(List1.List(ctr),1) = "A" then MsgBox ctr End if Next
VB Code:
For ctr = 0 To List1.ListCount [b]-1[/b]
And... if your dealing String Data Types, use the $ with the
relavent function, like: Left$ - Saves the double conversion by VB.