Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Sub Text1_KeyPress(KeyAscii As Integer) Dim p As Integer Dim z As Integer Select Case KeyAscii Case 8: Case 48 To 57: p = Text1.SelStart z = Len(Text1) - p If Val(Left$(Text1, p) & Chr$(KeyAscii) & Right$(Text1, z)) > 9999 Then KeyAscii = 0 Case Else: KeyAscii = 0 End Select End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer) Dim float As Long Dim message As String Dim titre As String Dim p As Integer Dim z As Integer Select Case KeyAscii Case 8: Case 48 To 57: p = Text1.SelStart z = Len(Text1) - p If Val(Left$(Text1, p) & Chr$(KeyAscii) & Right$(Text1, z)) > 9999 Then message = "Veuillez saisir une somme inférieure à 9999" titre = "Erreur" float = MsgBox(message, 10, titre) KeyAscii = 0 End If Case Else: message = "Veuillez saisir une somme" titre = "Erreur" float = MsgBox(message, 10, titre) KeyAscii = 0 End Select End Sub
If IsNumeric(Text1.Text) Then If Val(Text1.Text) >= -32768 And Val(Text1.Text) <= 32767 Then MsgBox "OK" Else MsgBox "pas de l'integer" End If Else MsgBox "pas numérique" End If
If IsNumeric(Text1.Text) Then Select Case Val(Text1.Text) Case -32768 To 32767 MsgBox "Integer" Case -2147483648# To 2147483647 MsgBox "Long" Case Else MsgBox "pas géré" End Select Else MsgBox "pas numérique" End If