Results 1 to 5 of 5

Thread: Drop Down Box for two

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 1999
    Location
    Rock Island
    Posts
    21

    Post

    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.

  2. #2
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670

    Post

    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
    BuzbyB@HotMail.Com



  3. #3
    Addicted Member
    Join Date
    Jan 2000
    Location
    Oshkosh, WI
    Posts
    163

    Post

    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.

  4. #4
    New Member
    Join Date
    Feb 2000
    Posts
    15

    Post

    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

  5. #5
    New Member
    Join Date
    Feb 2000
    Posts
    5

    Post

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width