Marko Stojovic
Registered User.
- Local time
- Today, 12:27
- Joined
- Jan 25, 2001
- Messages
- 29
Hello,
I'm getting really confused... I have a listbox which allows multiple selections. The listbox is called "lstResultList".
I'm trying to use this code (it's in an OnClick event in the form that has the listbox in it...):
If Me.lstResultList.ItemsSelected.Count > 0 Then
For m = 0 To Me.lstResultList.ItemsSelected.Count - 1
MsgBox Me.lstResultList.ItemData(m)
Next m
End If
Actually, I was trying to do something a bit more complex to start with, but I narrowed down the problem to this part. When I execute it, it stops on the MsgBox line, because it always evaluates Me.lstResultList.Itemdata(m) to NULL! At the same time, "?Me.lstResultList.ItemsSelected.Count" shows how many menu items have been highlighted, as expected. This really confuses me.
Does anyone have a clue why the programme might be recognising ItemData as Null for each of the items in the ItemsSelected collection for the control, even though the list box shows string values listed, lets me highlight a number of them, and has recognised them as highlighted?
Thanks in advance for easing my agony,
Marko.
[This message has been edited by Marko Stojovic (edited 07-23-2001).]
[This message has been edited by Marko Stojovic (edited 07-23-2001).]
I'm getting really confused... I have a listbox which allows multiple selections. The listbox is called "lstResultList".
I'm trying to use this code (it's in an OnClick event in the form that has the listbox in it...):
If Me.lstResultList.ItemsSelected.Count > 0 Then
For m = 0 To Me.lstResultList.ItemsSelected.Count - 1
MsgBox Me.lstResultList.ItemData(m)
Next m
End If
Actually, I was trying to do something a bit more complex to start with, but I narrowed down the problem to this part. When I execute it, it stops on the MsgBox line, because it always evaluates Me.lstResultList.Itemdata(m) to NULL! At the same time, "?Me.lstResultList.ItemsSelected.Count" shows how many menu items have been highlighted, as expected. This really confuses me.
Does anyone have a clue why the programme might be recognising ItemData as Null for each of the items in the ItemsSelected collection for the control, even though the list box shows string values listed, lets me highlight a number of them, and has recognised them as highlighted?
Thanks in advance for easing my agony,
Marko.
[This message has been edited by Marko Stojovic (edited 07-23-2001).]
[This message has been edited by Marko Stojovic (edited 07-23-2001).]