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
| Private rac As String, anc As String, deja As String
Private Sub Form_Activate()
anc = Text1.Text
rac = Left(anc, 10)
End Sub
Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
' on choisit le mousemove plutôt que le GotFocus pour éviter un autre petit problème)
couic
End Sub
Private Sub Text1_Change()
If Len(Text1.Text) < 10 Or Len(Text1.Text) > 12 Then Text1.Text = anc: couic: Exit Sub
If Not Text1.Text Like rac & String(Len(Text1.Text) - 10, "?") Then
Text1.Text = anc: couic
Else
anc = Text1.Text
End If
End Sub
Private Sub couic()
If Text1.SelStart > 10 Then Exit Sub
Text1.SelStart = 10: Text1.SelLength = 2 ' voilà (1er souci) de quoi assurerle confort de l'utilisateur
DoEvents
End Sub |