list boxes

  • Thread starter Thread starter Hugh Welford
  • Start date Start date
H

Hugh Welford

dumb question, maybe, but stuck without "help" or a manual.

can someone tell me how to detect which items have been selected from a
multi-selection list box - me!listbox.listindex will tell me a single, but
how do I know multi items?

thanks Hugh
 
You need to loop through the list and test the selected property.

for i = 0 to list.ListCount - 1
if list.Selected(i) then
'Line in list box has been selected
else
'Line in list box not selected
end if
next i

You will return the value in the bound column, if you need the value from
another column you will need to select that column, eg

if bound column is first column and you want the value from the second
column use the following:

list.column(1, i) where 1 is column number and i is the row number

Hope this helps
 
thanks steve - great help

Hugh


Steve said:
You need to loop through the list and test the selected property.

for i = 0 to list.ListCount - 1
if list.Selected(i) then
'Line in list box has been selected
else
'Line in list box not selected
end if
next i

You will return the value in the bound column, if you need the value from
another column you will need to select that column, eg

if bound column is first column and you want the value from the second
column use the following:

list.column(1, i) where 1 is column number and i is the row number

Hope this helps
 
Back
Top