Data comnbo auto drop down[RESOLVED]
I am using data combo in an application.
We know that, when we press on the drop-down arrow, drop down list appears on it.
What i want is that, when i enter the very first character in the data combo, its drop down list should automatically be shown.
Plz guide.
(if u don't understand what i am trying to say, plz let me know.)
Thankx
Re: Data comnbo auto drop down
I'm not sure if I understand what your trying to do, but, in the properties of your combobox change the "Style" property to 2 - Dropdown List and try that
ciao
JO
Re: Data comnbo auto drop down
DataCombos don't work the same way, in this respect, as does a standard combo. To auto drop down a datacombo, use this
VB Code:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Const VK_LBUTTON = &H1
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Sub DropOnFocus(CB As DataCombo)
Dim pt As POINTAPI
Dim lHandle As Long
Const HighBit = &H8000
Call GetCursorPos(pt)
lHandle = WindowFromPoint(pt.X, pt.Y)
If (lHandle <> CB.hWnd) Or ((GetAsyncKeyState(VK_LBUTTON) And HighBit) = 0) Then
SendKeys "%{Down}"
End If
End Sub
Re: Data comnbo auto drop down
Dear it works....
when i write a word, the matching word from the list appears in the data combo.
But...
I want that when i type the letter, the dopr down should get dropped(as i drops when we click on the rdop down arrow).
Re: Data comnbo auto drop down
Dear hack,
My reply was for the guy who replied before u.
I ma gona test ur adviced code
:)
Re: Data comnbo auto drop down
Did you put a call to the DropOnFocus sub in the GotFocus event of the datacombo?
Re: Data comnbo auto drop down
Thankx Hack,
It worked.
Thankx again
Re: Data comnbo auto drop down[RESOLVED]
In the event anyone reading this is interested, that code was for a DataCombo. The code to auto drop down a standard combo is much shorter.
VB Code:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
lParam As Long) As Long
Private Const CB_SHOWDROPDOWN = &H14F
Private Sub Combo1_GotFocus()
Dim lngDropDown As Long
lngDropDown = SendMessage(Combo1.hwnd, CB_SHOWDROPDOWN, 1, ByVal 0&)
End Sub
Re: Data comnbo auto drop down[RESOLVED]
Hack
Thankx for this also.
:)