Help with ListBox

S

Stealth1

How can I MsgBox the value of one of the items in my ListBox?
I tried this, but it didn't work...

MsgBox List0.Selected

In other words, my listbox has this in it...
Number Name Color
1 jeff blue
2 jamie red
3 johnson purple

So when I double-click on item #3 I would like to see "3 johnson purple".

Help?
 
G

Guest

Hi,
you would just need to define the columns e.g.:

MsgBox("The values selected are: " & Me.Listbox.Column(0) & " " &
Me.Listbox.Column(1) & " " & Me.Listbox.Column(2))

HTH
Good luck
 
A

Arvin Meyer [MVP]

Try:

Sub List0_Click()
MsgBox Me.List0.Column(0) & " " & Me.List0.Column(1) & " " &
Me.List0.Column(2)
End Sub

The column index starts at 0. If the first column is bound, you really don't
need the ".Column(0)"
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top