On Click Event on My Form

shamas21

Registered User.
Local time
Today, 19:37
Joined
May 27, 2008
Messages
162
Hi All

I have a listbox on my Form that is called lstEvents.

What I want is to click the item in the list box and return the value of the first column for the item i have selected.

The following code doesnt work with an On Click event on the list box but it does work for On Double Click Event on the list box:

Please see below

Doesn't Work: I need the below to work.
Code:
Private Sub lstEvents_Click()
 
MsgBox Me.lstEvents.ItemData(Me.lstEvents.ItemsSelected(i))
 
End Sub

Does Work:
Code:
Private Sub lstEvents_DblClick(Cancel As Integer)
 
MsgBox Me.lstEvents.ItemData(Me.lstEvents.ItemsSelected(i))
 
End Sub
 
how about:
Code:
Private Sub lstEvents_Click()
    MsgBox Me.lstEvents.Column(0) 
End Sub
 
If the first column is the "bound" column (not the bound field, mind you but the bound column) and this is a single select list box then you can just get it with the value:
Code:
MsgBox Me.lstEvents
 
If the first column is the "bound" column (not the bound field, mind you but the bound column) and this is a single select list box then you can just get it with the value:
Code:
MsgBox Me.lstEvents


Guys, Thank you so much for this.. both solutions work fantastic... Thanks Again!
 

Users who are viewing this thread

Back
Top Bottom