sgkdnay
Technical User
- Aug 4, 2008
- 21
Tried to find the "proper" way to do arrays, but for the life of me, couldnt get it to display on my listbox test. Trying to learn few things here and there. Hope you could help shed some light here.
Private Sub arraytest()
'On Error Resume Next
Dim Sta() As String, lsta As Long
Dim ABC() As String, labc As Long
Dim i As Integer
Sta() = Array("AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY")
ABC() = Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")
i = 0
For lsta = LBound(Sta) To UBound(Sta)
For labc = LBound(ABC) To UBound(ABC)
i = i + 1
List1.Text = i & " - " & lsta & " : " & labc
Next labc
Next lsta
End Sub
What did i do wrong?
Thanks
Private Sub arraytest()
'On Error Resume Next
Dim Sta() As String, lsta As Long
Dim ABC() As String, labc As Long
Dim i As Integer
Sta() = Array("AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY")
ABC() = Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")
i = 0
For lsta = LBound(Sta) To UBound(Sta)
For labc = LBound(ABC) To UBound(ABC)
i = i + 1
List1.Text = i & " - " & lsta & " : " & labc
Next labc
Next lsta
End Sub
What did i do wrong?
Thanks