Listbox Columns?

RainX

Registered User.
Local time
Today, 08:02
Joined
Sep 22, 2006
Messages
89
is there anyway to have more than one column appear on a listbox or would this be more suited for another control? (through vba ofcourse)

Thanks in advance
 
Listboxes may have multiple columns, but the first column is what is used as the "value"
 
So if i wanted to input something like Twp (column 1) and Active (column 2) into the first row
and 79 (column 1) and 35 (column 2) into the second row, how would i do this via vba?

Sorry i'm still getting used to this.


take care
 
but the first column is what is used as the "value"

Sorry, but that is an inaccurate statement. The first column doesn't have to be the one used as the "value." The column used for the value is whatever column you set to be the BOUND column. It could be column 23 (if you had as many). You can display multiple columns by selecting the number you want in the combo box's rowsource and then you set the number of columns in the combo box by setting the "ColumnCount" property to the right number you want from the query (it will take the number of them counting from the left) and then setting the column widths to whatever you want and separating them with semi-colons (;) and setting the width to 0" if you don't want a particular column displayed.

So, if I have 4 columns and the 3rd one is my bound column and I don't want that one to show I would have:
ColumnCount 4
BoundColumn 3
ColumnWidths 1";.7";0";1.4"
 
To reference another column, other than the bound column, use:

Me.YourComboBoxNameHere.Column(2)

2 in this case means the THIRD column as it is zero based counting when used in this manner.
 
Hey bob,

Actually this is in visual basic 6 and the Listbox Doesnt have a Column attribute.
There is something called Columns, but i tried that and it didnt work either.
Me.Listbox.Column(number) isnt working.
Anything else which i can try?

Take care
 
Last edited:
Well, two things come to mind.
1. You probably should have said that to begin with.
2. This should go in the VB forum that is down the list further.

So, I am not sure how that works as I haven't used them all that much in the VB stuff I've done. Hopefully someone else will. Maybe you should post a new question in the VB area down below.
 
Oh, and after re-reading my last message, I can see where it might have come across that I was angry or something. Just so you know, I wasn't. Just want to help you get help.
 

Users who are viewing this thread

Back
Top Bottom