Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple columns in a combo box

Status
Not open for further replies.

Wallegator

Programmer
Jan 3, 2001
58
0
0
US
Is there any way to show multiple columns of data in a combo box? For example

Initials Name
gw George Washington
al Abraham Lincoln

Initials would be the field bound. Is there a better tool to use as opposed to combo box?
 
I could suggest using some string manipulation then filling combobox, like:

combo1.add format(anInitials, "!@@@")+" "+aName

So it will _look_ like having two columns.
Of cource it will work fine only if you need a drop-down list (non-editable).
 
If you want the second column to line up use vbTab:

Combo1.AddItem strItem1 & vbTab & strItem2
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
The Tab only works if the text in the first column is not too long. You may want to use 2 tabs. And then you still may have a problem here. So you would need to find the leght of the longest text in and calc how many tabs wide it would be.
Try using a list view or list box, and combo box together. Or use the combo box from Ms Forms 2.0
 
VBOldTimer
[smile]
How many initials do you guys have?
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
"How many initials do you guys have?"
johnwm, what do you mean? (maybe I'm just a little dense this morning)
 
Ok. I understand now lol
I wasn't thinking the lenghts of the columns in this example being only 3 or so characters, but the problem in general.
Yes, for something so small the tab seperator will work fine.
Therefore I stated:
"The Tab only works if the text in the first column is not too long"

and was thinking more on others who read and try this for different situations.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top