Results 1 to 4 of 4

Thread: [RESOLVED] [2005] Sendmessage and Combobox

  1. #1

    Thread Starter
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Resolved [RESOLVED] [2005] Sendmessage and Combobox

    I'm attempting to find an item in a combo box using the below code however each time it returns 0 (which is incorrect)? Any suugestions?

    Code:
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
    Private Const CB_FINDSTRING As Integer = &H14C
    
    
    Dim index as Long
    
    index = SendMessage(cboPriceStyles.HostedControl.Handle, CB_FINDSTRING, -1, "Bar")

  2. #2
    PowerPoster VBDT's Avatar
    Join Date
    Sep 2005
    Location
    CA - USA
    Posts
    2,922

    Re: [2005] Sendmessage and Combobox

    Why do you use SendMessage API function to get the index of the ComboBox item? You can simply use IndexOf method of ComboBox.Items to get the index of the item with simple data type.
    vb Code:
    1. Dim index As Integer
    2. index = Me.ComboBox1.Items.IndexOf("Bar")

  3. #3

  4. #4

    Thread Starter
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: [2005] Sendmessage and Combobox

    Thanks. I had used SendMessage in VB6. I guess there are a few things different in VB.net

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