OVH Cloud OVH Cloud

Saisie obligatoire dans textbox

2 réponses
Avatar
Milan DESHAYES
Bonsoir
Dans un textbox, je souhaite que le premier caractère saisi soit
obligatoirement un 1 ou un 2
Je vous remercie

2 réponses

Avatar
JB
Bonsoir,

Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If Len(Me.TextBox2) < 1 Then
If InStr("12,", Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Beep
End If
End If
End Sub

JB


On 17 sep, 21:02, "Milan DESHAYES" wrote:
Bonsoir
Dans un textbox, je souhaite que le premier caractère saisi soit
obligatoirement un 1 ou un 2
Je vous remercie


Avatar
Milan DESHAYES
Merci beaucoup
Milan

"JB" a écrit dans le message de news:

Bonsoir,

Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If Len(Me.TextBox2) < 1 Then
If InStr("12,", Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Beep
End If
End If
End Sub

JB


On 17 sep, 21:02, "Milan DESHAYES" wrote:
Bonsoir
Dans un textbox, je souhaite que le premier caractère saisi soit
obligatoirement un 1 ou un 2
Je vous remercie