954,535 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Multi column combobox

I need to place two columns within a single combo box.
But in VB, I found that we can place more than one column in list box by using columns property.
I dont know how to place more than one column in combo box.

Please help me on this.

gowri_itech
Newbie Poster
5 posts since Jul 2007
Reputation Points: 10
Solved Threads: 0
 

hi,


U can use the tab or space for more than one column in combo box like this

:idea:
combo1.additem("Apple" & vbtab & vbtab & "Mango")

or


combo1.additem("Apple" space(25-len("Mango")) & "Mango")


best regards
shailu.

manoshailu
Junior Poster
105 posts since Jun 2007
Reputation Points: 34
Solved Threads: 10
 

Hi,

U can also use a Special NonPrintable Character like:

Combo1.AddItem ("1" & Chr(165) & "One")

When u need to Seperate them, use "Instr" Function

Regards
Veena

QVeen72
Posting Shark
950 posts since Nov 2006
Reputation Points: 84
Solved Threads: 143
 
Hi, U can also use a Special NonPrintable Character like: Combo1.AddItem ("1" & Chr(165) & "One") When u need to Seperate them, use "Instr" Function Regards Veena

hi veena,

:-/
chr(165) = ¥

while using chr(165), it looks some character is added in between two strings. But the requirement is to create two columns in the combo box so space or tab makes as two columns in the combo box.

regards
shailu

manoshailu
Junior Poster
105 posts since Jun 2007
Reputation Points: 34
Solved Threads: 10
 

Thank you for your suggestions. But a problem is first column char size is 255 and second col char size is 70. So We cant able to see the second column

gowri_itech
Newbie Poster
5 posts since Jul 2007
Reputation Points: 10
Solved Threads: 0
 

Hi,

Better use a ListView Control or a MSFlexGrid Control. Users can Alter the ColumnWidth.

Regards
Veena

QVeen72
Posting Shark
950 posts since Nov 2006
Reputation Points: 84
Solved Threads: 143
 

hi,

I have attached a file with this. Copy the file to ur project and try.

In that file there could be one form and class module.

In that class module there could be a line

ret = ClientToScreen(Form7.Combo3.hwnd, pt)
Form7 - form name
combo3 - combo box name

change it as ur requirement.

while running ur form press the arrow key to view the columns in the combo box

al the best
Shailu

Attachments Combo.zip (4.53KB)
manoshailu
Junior Poster
105 posts since Jun 2007
Reputation Points: 34
Solved Threads: 10
 

Thank you. Its good

gowri_itech
Newbie Poster
5 posts since Jul 2007
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You