By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,480 Members | 3,113 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,480 IT Pros & Developers. It's quick & easy.

List Box colums - and value retrieval

100+
P: 553
From a List Box, how to get value in 2nd column ?

If we do Listbox0.Value , then we get the selected value in the first column only. How can i get value in 2nd column ?


Thanks
Jul 19 '07 #1
Share this Question
Share on Google+
3 Replies


JKing
Expert 100+
P: 1,206
You can use the following:
Expand|Select|Wrap|Line Numbers
  1. Me.List.Column(1, Me.List.ItemsSelected(0))
  2.  
The first parameter is the position of the column you want. This starts at 0 so 0 would be 1 and 1 would be 2 etc.
The second parameter is the row and Me.List.ItemsSelected(0) points to the first row of the selected items. If you're using a multi-select just add a for loop to cycle through the selectedItems.
Jul 19 '07 #2

100+
P: 553
I have only these Column properties available for my listbox - I am using VBA

ColumnHidden
ColumnOrder
ColumnWidth

do you know how to do with VBA?

You can use the following:
Expand|Select|Wrap|Line Numbers
  1. Me.List.Column(1, Me.List.ItemsSelected(0))
  2.  
The first parameter is the position of the column you want. This starts at 0 so 0 would be 1 and 1 would be 2 etc.
The second parameter is the row and Me.List.ItemsSelected(0) points to the first row of the selected items. If you're using a multi-select just add a for loop to cycle through the selectedItems.
Jul 19 '07 #3

JKing
Expert 100+
P: 1,206
I am also using VBA. The Column property is supported for both listboxes and combo boxes.
Jul 19 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.