|
Tipp 0154
|
ComboBox automatisch aufklappen
|
|
|
Autor/Einsender: Datum: |
|
Angie 02.11.2001 |
|
Entwicklungsumgebung: |
|
VB 5 |
|
|
Um eine ComboBox bei Erhalt des Fokus automatisch aufklappen zu lassen, bedarf es
nur der API-Funktion SendMessage und einer Zeile Code im
GotFocus-Ereignis der ComboBox.
|
|
|
Option Explicit
Private Declare Function SendMessage Lib "user32" Alias _
"SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const CB_SHOWDROPDOWN = &H14F
Private Sub Form_Load()
Dim i As Integer
For i = 1 To 10
Combo1.AddItem "List-Eintrag " & i
Next i
Combo1.ListIndex = 0
End Sub
Private Sub Combo1_GotFocus()
SendMessage Combo1.hwnd, CB_SHOWDROPDOWN, True, 0
End Sub
|
|
|
|
|
Windows-Version |
95 |
|
|
98/SE |
|
|
ME |
|
|
NT |
|
|
2000 |
|
|
XP |
|
|
Vista |
|
|
Win
7 |
|
|
|
VB-Version |
VBA 5 |
|
|
VBA 6 |
|
|
VB 4/16 |
|
|
VB 4/32 |
|
|
VB 5 |
|
|
VB 6 |
|
|
|
|
Download (2 kB)
|
Downloads bisher: [ 2085 ]
|
|
|