If you go to the Code Bank section this forum, search for AutoComplete in that section. I believe you will find what you are looking for. Not that we can't explain it here, but it would take a lot of space and probably a lot of time.
I am not fill the combo box when I insert the value in the textbox. I just want, when I try typing something in the textbox, the combo box, automatically pull down.
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
Const CB_SHOWDROPDOWN = &H14F
Private Sub Command1_Click()
SendMessage Combo1.hwnd, CB_SHOWDROPDOWN, 1, 0
End Sub
Last edited by zynder; Oct 20th, 2007 at 12:20 PM.
I have problem here. The combo box drop down when I try type something in the textbox . When I clear the textbox, the combo box not pull back the dropdown. How I can pull back the dropdown when no value in the textbox?
On Error GoTo error
If Text2.Text <> 0 Then
SendMessage Combo1.hwnd, CB_SHOWDROPDOWN, 1, 0
ElseIf Text2.Text = "" Then
SendMessage Combo1.hwnd, CB_SHOWDROPDOWN, 0, 0
End If
error:
actually, on what event you call this SendMessage? imean Text1_Change() or Text1_Click() etc.
I put at text_Change(). The combo box not drop back after I clear the text in the textbox.How I can drop it back?When I try typing something in the textbox, combo box drop down but my mouse cursor disappear.How to appear the mouse cursor when the combo box drop down?
matrik, you if condition first statement is has a problem also.
i just corrected it.
Code:
Private Sub Text2_Change()
If Text2.Text <> "" Then
SendMessage Combo1.hwnd, CB_SHOWDROPDOWN, 1, 0
ElseIf Text2.Text = "" Then
SendMessage Combo1.hwnd, CB_SHOWDROPDOWN, 0, 0
End If
End Sub
Why not just use a listbox??? Rather than trying to do algorithm gymnastics... Simply put, the combo box wasn't designed to work that way (square peg into round hole analogy).
Mouse cursor disappears, GUI lock. And what's the point of just dropping it it isn't an auto-complete feature (select/display matching item in dropdown list)?
there is no problem with combo dropdown and retake.
i have attched a woking project. curso is the only issue you have now
Thank you so much Fazi. The problem is, my mouse cursor disappear.I can only move my mouse without cursor. .Anyone now how to set a mouse cursor when the combo box drop down?
Mouse cursor disappears, GUI lock. And what's the point of just dropping it it isn't an auto-complete feature (select/display matching item in dropdown list)?
Actually I just want to drop down the combo box only when the user typing something on the textbox.When the combo box drop down, the user can choose the items on the combo box. That mean, user have two option either choose from combo box or typing something on combo box to let user choose the items from drop down combo box. The problem is, the the mouse cursor disappears and GUI lock. How to unlock the GUI and set the mouse cursor for combo box when the combo box drop down?
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
Const CB_SHOWDROPDOWN = &H14F
Private Sub Form_Load()
Me.Combo1.AddItem "1"
Me.Combo1.AddItem "2"
End Sub
Private Sub Text2_Change()
If Text2.Text <> "" Then
SendMessage Combo1.hwnd, CB_SHOWDROPDOWN, 1, 0
ElseIf Text2.Text = "" Then
SendMessage Combo1.hwnd, CB_SHOWDROPDOWN, 0, 0
Me.SetFocus
End If
End Sub
Private Sub Text2_Change()
If Text2.Text <> "" Then
SendMessage Combo1.hwnd, CB_SHOWDROPDOWN, 1, 0
Combo1.MousePointer = 1
Combo1.SetFocus
ElseIf Text2.Text = "" Then
SendMessage Combo1.hwnd, CB_SHOWDROPDOWN, 0, 0
Me.SetFocus
End If
End Sub
Private Sub Text2_Change()
If Text2.Text <> "" Then
SendMessage Combo1.hwnd, CB_SHOWDROPDOWN, 1, 0
Combo1.MousePointer = 1
Combo1.SetFocus
ElseIf Text2.Text = "" Then
SendMessage Combo1.hwnd, CB_SHOWDROPDOWN, 0, 0
Me.SetFocus
End If
End Sub
This works just fine. I just tested it. Are you having a problem with it?
matrik,
sorry, it did not work. but this topic seems have beed discussed on the net.
google for "SendMessage Mouse disappears" returned many results.
pls check. i am about to leave.