Afficher le contenu d'un combobox sans la souris

cs_tamsir Messages postés 9 Date d'inscription samedi 9 mars 2002 Statut Membre Dernière intervention 20 novembre 2005 - 31 déc. 2002 à 16:45
cs_wape Messages postés 262 Date d'inscription samedi 21 décembre 2002 Statut Membre Dernière intervention 19 décembre 2010 - 1 janv. 2003 à 13:38
Ibrahima vous salue bienIbrahima vous salue bien

J'ai developpé une application qui marche bien mais j'aimerai l'améliorer .
La chose que je veux est la suivante : pouvoir afficher le contenu d'un combo box rien qu'en tabulant à parti du champ qui juste avant le combo sanc clic de souris
Merci etUrgent

1 réponse

cs_wape Messages postés 262 Date d'inscription samedi 21 décembre 2002 Statut Membre Dernière intervention 19 décembre 2010 12
1 janv. 2003 à 13:38
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer

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 VK_TAB = &H9
Const CB_SHOWDROPDOWN = &H14F

Private Sub Combo1_GotFocus()

'Si la touche "Tab" a été pressée et la combo n'est pas vide
If GetKeyState(VK_TAB) < 0 And Combo1.ListCount > 0 Then
'Ouvrir la combo
DropDown Combo1
'Si nécessaire...
Combo1.ListIndex = 0
End If

End Sub

Public Sub DropDown(ComboBox As ComboBox)

SendMessage ComboBox.hwnd, CB_SHOWDROPDOWN, True, 0

End Sub

@+ et bonne année.

wape
0
Rejoignez-nous