|
-
Jun 3rd, 2005, 08:15 AM
#1
Thread Starter
Addicted Member
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
Last edited by engineer; Jun 3rd, 2005 at 11:19 AM.
software engineer
-
Jun 3rd, 2005, 08:25 AM
#2
Fanatic Member
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
"I have not failed. I've just found 10,000 ways that won't work."
'Thomas Edison'
"If we knew what it was we were doing it wouldn't be called research, would it?"
'Albert Einstein'
VB6
-
Jun 3rd, 2005, 08:44 AM
#3
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
-
Jun 3rd, 2005, 08:49 AM
#4
Thread Starter
Addicted Member
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).
-
Jun 3rd, 2005, 08:53 AM
#5
Thread Starter
Addicted Member
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
-
Jun 3rd, 2005, 08:53 AM
#6
Re: Data comnbo auto drop down
Did you put a call to the DropOnFocus sub in the GotFocus event of the datacombo?
-
Jun 3rd, 2005, 11:15 AM
#7
Thread Starter
Addicted Member
Re: Data comnbo auto drop down
Thankx Hack,
It worked.
Thankx again
-
Jun 3rd, 2005, 11:28 AM
#8
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
-
Jun 3rd, 2005, 12:30 PM
#9
Thread Starter
Addicted Member
Re: Data comnbo auto drop down[RESOLVED]
Hack
Thankx for this also.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|