ListBox Columns

D

dsc

I have a ListBox with three columns.

ListBox1.value returns only the value in the third column of whatever row I
select.

How can I return the value from the second column of the selected row?

I've been all over the Internet, and can't seem to stumble across anything.

Thanks in advance for any assistance.
 
D

Doug Robbins - Word MVP

Hi dsc,

Use the .BoundColumn property of the listbox to control what is returned.

ListBox1.BoundColumn=2

will cause the value from the second column to be returned.

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 
D

dsc

Doug Robbins - Word MVP said:
Hi dsc,

Use the .BoundColumn property of the listbox to control what is returned.

ListBox1.BoundColumn=2

will cause the value from the second column to be returned.

Thanks. And with just one more tweak, I think I'll be done. Is there a way
to set different column widths?

I don't know what I can do to return the favor, except that anybody who
wants is welcome to see and use what I've put together.
 
D

Doug Robbins - Word MVP

Hi dsc,

You can do it at the design stage by specifying the width for each column in
the ColumnWidth field of the Properties window for the ListBox or to do it
with code

ListBox1.ColumnCount = 3
ListBox1.ColumnWidths = "#;#;#"

where # is a numeric entry that will represent the column width in points of
which there are 72 to the inch.

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 

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