Results 1 to 2 of 2

Thread: can you force combobox to display list?

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Location
    MN
    Posts
    1

    Post

    Hi
    Is there a way to force a combobox to diplay it's list, like when a user clicks on the arrow, but do it using code?
    Thanks!
    dobs

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Sure. Try this:
    Code:
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Private Const CB_SHOWDROPDOWN = &H14F
    
    Private Sub Command1_Click()
        Static bShow As Boolean
        
        bShow = Not bShow
        Call SendMessage(Combo1.hwnd, CB_SHOWDROPDOWN, bShow, 0)
    End Sub
    
    
    Private Sub Form_Load()
        Dim i As Integer
        
        For i = 1 To 10
            Combo1.AddItem i
        Next
    End Sub

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