CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2001
    Location
    London, UK
    Posts
    275

    I want a ComboBox to expand(drop down the list) whenever it gets focus

    I want a ComboBox to expand(drop down the list) whenever it gets focus.
    I am thinking abiut getting a handle to mouse and firing its click or mouse down event for left button on the location where that particular ComboBox is placed. But dont know how to get the mouse handle?
    Any Idea about mouse handle or direclty manipulating ComboBox as i need it?

  2. #2
    Join Date
    Apr 2003
    Posts
    1,755

    Smile

    Use this code
    Code:
    Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" _
       (ByVal hwnd&, ByVal wMsg&, ByVal wParam&, ByVal lParam&) As Long
    Private Const CB_SHOWDROPDOWN = &H14F
    
    Private Sub Combo1_GotFocus()
       Call PostMessage(Me.Combo1.hwnd, CB_SHOWDROPDOWN, 1, 0)
    End Sub
    Hope it will help you

  3. #3
    Join Date
    Mar 2003
    Location
    Lahore,Pakistan
    Posts
    107

    combobox

    Hi

    for this purpose u can use shredian Grid Control that has many enhanced features for developer i hope it will provide an ease for you for future developement

    Bye...
    Shahzeb Khan

  4. #4
    Join Date
    Feb 2001
    Location
    PA
    Posts
    163
    For a simple solution try using Sendkeys "{F4}" in the Got_Focus event. This should drop down the list.

  5. #5
    Join Date
    Nov 2001
    Location
    London, UK
    Posts
    275

    Thumbs up

    Good work rxbagain!

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

Featured