How to retrieve data from unbound listbox.

C

cr113

I'm trying to retrieve data from a multi-column, unbound listbox.

Suppose you create a simple unbound listbox with 2 columns.

Then use the following to fill the listbox:

ListBox1.AddItem("a;1")
ListBox1.AddItem("b;2")

Suppose the user highlights the second row, the one with a "b" in the
1st column. How would I retrieve the data in column 2 (in this case a
2)?
 
F

fredg

I'm trying to retrieve data from a multi-column, unbound listbox.

Suppose you create a simple unbound listbox with 2 columns.

Then use the following to fill the listbox:

ListBox1.AddItem("a;1")
ListBox1.AddItem("b;2")

Suppose the user highlights the second row, the one with a "b" in the
1st column. How would I retrieve the data in column 2 (in this case a
2)?

Retrieve it where? And do what with it?
As the control source of an unbound control:
=[ListBoxName].Column(1)

List boxes (and Combo Boxes) are Zero based. Column(1) is the 2nd
column.
 
C

cr113

I'm trying to retrieve data from a multi-column, unbound listbox.
Suppose you create a simple unbound listbox with 2 columns.
Then use the following to fill the listbox:

Suppose the user highlights the second row, the one with a "b" in the
1st column. How would I retrieve the data in column 2 (in this case a
2)?

Retrieve it where? And do what with it?
As the control source of an unbound control:
=[ListBoxName].Column(1)

That's exactly what I needed.

Thanks!
 

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