Click to See Complete Forum and Search --> : How to process selecting from a listbox


Sharkky
July 14th, 2003, 02:16 PM
I need to process an event of selecting an item from the listbox. But there is no such event. There is a property .selected. You can write for example list18.selected(4), that can be true or false.

But there is also a problem with using this property. The procedure listed below should put the number of selected item into title3.caption, but it falls into an endless cycle => there is no selected item in the listbox.

Private Sub list18_Enter()
i = 0
Do
i = i + 1
Loop While list18.Selected(i) = False

title3.Capton = i

End Sub

I start this procedure as an answer to onEnter event. If I do the same with gotFocus event the result is the same.

How can I process the choosing of the item?

Ahmed Saber
July 14th, 2003, 09:50 PM
I am not sure what database you are using. If you are using Access, try this.

Private Sub List1_Click()
Label3.Caption = List1
End Sub

where List1 is the list box. If you click any item in the list box, the value of the item will apper in Label3.

Sharkky
July 15th, 2003, 03:58 AM
... But it appears only the item situated into the first column of List Box, how should I act to recieve items wich are situated into other columns?