PDA

View Full Version : Help W/UserForm



OrphanBear
04-27-2009, 12:41 PM
Hi,

Once a user double clicks on an item in my listbox, I would like a message box to appear with the value they clicked on. The problem is the value is not the bound column. I tried



me.listbox1.value


but that give the value of the bound column.





Private Sub UserForm_initialize()
Me.ListBox1.ColumnCount = 1
Me.ListBox1.BoundColumn = 2

Me.ListBox1.RowSource = "MyBound"
End Sub


Thanks for any help.

Benzadeus
04-27-2009, 01:04 PM
MsgBox Me.ListBox1.Text

OrphanBear
04-27-2009, 01:13 PM
Hi I tried that but I get a blank msgbox??

OrphanBear
04-27-2009, 01:28 PM
Any Idea??

slamet Harto
04-27-2009, 07:55 PM
I've tried as Dave suggestion and work well.

Private Sub ListBox1_Click()
MsgBox Me.ListBox1.Text
End Sub
Private Sub UserForm_initialize()
Me.ListBox1.ColumnCount = 2
Me.ListBox1.BoundColumn = 2

Me.ListBox1.RowSource = "MyBound"
End Sub

Bob Phillips
04-28-2009, 12:29 AM
With Me.ListBox1

MsgBox .List(.ListIndex, 0)
End With