booleano

 

rem uso di controllo carattere da tastiera

Private Sub CommandButton1_Click()
Dim errore As Boolean
If numero.Text > 10 Then errore = True
numero = ""
If errore Then
MsgBox "scrivi numero inferiore a 10"
numero.SetFocus
End If
End Sub
------------------------------------------------
Rem uso di controllo carattere da tastiera
Rem accetta solo numeri interi e minori di 10
Private Sub CommandButton1_Click()
Dim errore As Boolean
Dim errore1 As Boolean
If numero.Text <> Int(numero.Text) Then errore = True
If errore Then
MsgBox "scrivi numero intero"
numero.SetFocus
End If
If numero.Text > 10 Then errore1 = True
numero = ""
If errore1 Then
MsgBox "scrivi numero < di 10"
numero.SetFocus
End If
End Sub
--------------------------------------------------
Rem uso di controllo carattere da tastiera
Rem accetta solo numeri
Private Sub CommandButton1_Click()
Dim errore As Boolean
If IsNumeric(numero.Text) = False Then errore = True
If errore Then
MsgBox "scrivere valore numerico"
numero.SetFocus
numero.Text = ""
End If
End Sub
---------------------------------------------------
Rem uso di controllo carattere da tastiera
Rem accetta solo carattere
Private Sub CommandButton1_Click()
Dim errore As Boolean
If IsNumeric(numero.Text) = True Then errore = True
If errore Then
MsgBox "scrivere carattere "
numero.SetFocus
numero.Text = ""
End If
End Sub
-----------------------------------------------
Rem uso di controllo carattere da tastiera
Rem accetta solo carattere
Private Sub CommandButton1_Click()
Dim errore As Boolean
If IsNumeric(numero.Text) = False Then errore = False

If IsNumeric(numero.Text) = True Then errore = True
If errore Then
MsgBox "scrivere carattere "
numero.SetFocus
numero.Text = ""
End If
End Sub
---------------------------------------------------

 

ritorna