bonjour,

voilà je voulais adapter cette fonctionnalité à une dataCombo, le code ci-dessous est pour une combobox :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 
Private Sub Combo1_KeyPress(KeyAscii As Integer)
    Dim Trouve As Long, Position As Integer, Taille As Integer
    Dim strTemp As String
    With Me.Combo1
        If KeyAscii = 8 Then
            If .SelStart = 0 Then Exit Sub
            .SelStart = .SelStart - 1
            .SelText = ""
        Else
            Position = .SelStart
            strTemp = .Text
        End If
        .SelText = Chr(KeyAscii)
        Trouve = SendMessage(.hwnd, CB_FINDSTRING, 0, ByVal .Text)
        If Trouve = -1 Then
            ' les trois lignes suivantes doivent être enlevées
            ' en cas de non correspondance possible
            .Text = strTemp
            .SelStart = Position
            .SelLength = (Len(.Text) - Position)
            KeyAscii = 0
            Exit Sub
        Else
            Position = .SelStart
            Taille = Len(.List(Trouve)) - Len(.Text)
            .SelText = .SelText & Right(.List(Trouve), Taille)
            .SelStart = Position
            .SelLength = Taille
            KeyAscii = 0
        End If
    End With
End Sub

et bien sur la propriété ".List", n'existe pas pour une datacombo, donc j'ai essayé avec la listField, mais ça pose un pb aussi, vu que ça ne renvoie pas le même type de valeur.

Si quelqu'un peut m'aider s'il vous plait, merci