Dovberman
asked on
I need to parse list box rows. VBA
I have a multiple column list box. I need to iterate through each row and read the column values
What is the syntax?
For example:
Dim intCtr as integer
Dim strCol0Value as string
Dim strCol1Value as string
For intCtr=0 To listbox.Listcount -1
strCol0Value = MyValuelistbox (??)
strCol1Value MyValuelistbox (??)
Next intCtr
Or can I declare listbox items ?
For each item in listbox
strCol0Value=??
strCol0Value=??
Next item
thanks
What is the syntax?
For example:
Dim intCtr as integer
Dim strCol0Value as string
Dim strCol1Value as string
For intCtr=0 To listbox.Listcount -1
strCol0Value = MyValuelistbox (??)
strCol1Value MyValuelistbox (??)
Next intCtr
Or can I declare listbox items ?
For each item in listbox
strCol0Value=??
strCol0Value=??
Next item
thanks
ASKER
The source is a value list. There are 2 list boxes. One contains all available choices. The other contains the choices that were selected from list 1.
I need to update a table based on the items in list 2.
I need to update a table based on the items in list 2.
ASKER
I found code for parsing and finding selected rows. Since all rows need to be read, I can remove the selected criteria.
For intCtr = 0 To lstApplicants.ListCount - 1
'isSelected = lstApplicants.Selected(int Ctr)
'If isSelected Then
lstApplicants.ItemData (intCtr) ' returns the data from column 0
'Do Stuff
End If
Next
For intCtr = 0 To lstApplicants.ListCount - 1
'isSelected = lstApplicants.Selected(int
'If isSelected Then
lstApplicants.ItemData (intCtr) ' returns the data from column 0
'Do Stuff
End If
Next
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the extra information
;-)
Why not just iterate through the Listbox's source Table (or Query)?
What exactly are you trying to accomplish here?
JeffCoachman