Is there a drop down control that ships with VB6 that I can use to hold two columns of data.
Example
Column One Column Two
1 Apples
2 Oranges
3 Grapes
I would like to display to the user only column two.
Printable View
Is there a drop down control that ships with VB6 that I can use to hold two columns of data.
Example
Column One Column Two
1 Apples
2 Oranges
3 Grapes
I would like to display to the user only column two.
No, but there is an ItemData property for each item in a combobox so you could display "Apples" and then retrieve the itemdata value of 1 when a user clicks on it. Search the help for ItemData for more details.
------------------
Mark "Buzby" Beeton
VB Developer
[email protected]
The simple answer is no :(. Why MS has not provided a columned dropdown is anybodys guess (Its been part of Access for a long time). I'd like to see them provide it, your only choice currently is a 3rd party control.
Here's an option...
this will work for a list box... You could place a textbox to the left of a button and a listbox below them. when you click on the button it could show the listbox. (Basically create your own combo dropdown.
Here is the code to modify the List1 listbox.
'Form Code
Private Sub Form_Load()
' paste into form_load or your tab routine
ReDim TabArray(0 To 1) As Long
TabArray(0) = 0
TabArray(1) = 61
'clear any existing tabs
Call SendMessage(List1.hwnd, LB_SETTABSTOPS, 0&, ByVal 0&)
'set the list tabstops
Call SendMessage(List1.hwnd, LB_SETTABSTOPS, 2&, TabArray(0))
List1.Refresh
List1.AddItem "test" & vbTab & "test"
List1.AddItem "test" & vbTab & "test"
List1.AddItem "test" & vbTab & "test"
List1.AddItem "test" & vbTab & "test"
List1.AddItem "test" & vbTab & "test"
End Sub
'Module Code
Public Const LB_SETTABSTOPS As Long = &H192
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
------------------
Hope this helps.
J.R. Berard
AutoCAD Programmer/Analyst
Here's what I did.
Private Sub Form_Load()
combo1.AddItem "1 " & " Apple"
End Sub
That's it if you run the program then
you will see 1 and a space then Apple. If
you wish more space between the two just
put the space between the quotation marks.
However to only show column 2 then you could
use the len property under the click event.