Tab in a combo box VB6

steveh
SilverLounger
Posts: 1952
Joined: 26 Jan 2010, 12:46
Location: Nr. Heathrow Airport

Tab in a combo box VB6

Post by steveh »

Hi all

I don't know if this is possible but within a text box command I seem to be able to tab but cannot within a combo box

What I am doing is bringing 2 text fields together into a combo box, this is the account number and the account name, the account number can be between 4 and 20 alpha numerics, but at the moment the account name does not align even though I am trying to put in spaces, I thought that perhaps if I use a tab command or something to simulate a tab command it would help me put them into the same position, I can't seem to get a screenshot but the below graphic sort of shows what is happening
You do not have the required permissions to view the files attached to this post.
Steve
http://www.freightpro-uk.com" onclick="window.open(this.href);return false;
“Tell me and I forget, teach me and I may remember, involve me and I learn.”
― Benjamin Franklin

User avatar
HansV
Administrator
Posts: 79365
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Tab in a combo box VB6

Post by HansV »

You could use code such as

ComboBox1.AddItem strPart1 & vbTab & strPart2

but it may not have the desired effect if the account number can vary from 4 to 20 characters.
Best wishes,
Hans

Becks
2StarLounger
Posts: 196
Joined: 31 Mar 2011, 03:41
Location: Perth, Western Australia

Re: Tab in a combo box VB6

Post by Becks »

What about using a combo box with 2 columns ?

Kevin

User avatar
HansV
Administrator
Posts: 79365
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Tab in a combo box VB6

Post by HansV »

A combo box with two columns would be perfect for the dropdown list, but only the first column would be displayed in the text box part of the combo box.
Best wishes,
Hans

Becks
2StarLounger
Posts: 196
Joined: 31 Mar 2011, 03:41
Location: Perth, Western Australia

Re: Tab in a combo box VB6

Post by Becks »

Create a combo box with 3 columns. Make the first column 1 pt wide: ColumnWidths = "1 pt;48 pt" or somesuch
In the first column, put the combined text as per HansV's suggestion. In second and third columns put the account number and the account name
The very small column width means it won't show when the list is in drop-down but will be used as the BoundColumn (but if it were set to zero then it can't be used as the BoundColumn)
Caveat - functionality only tested using Excel

Kevin

User avatar
HansV
Administrator
Posts: 79365
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Tab in a combo box VB6

Post by HansV »

Good idea!
Best wishes,
Hans