1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Try
' récupération du salaire
nombre = Integer.Parse(Box_convertir.Text)
' il doit être >=0
If nombre < 0 Then
Throw New Exception("")
End If
Catch ex As Exception
' msg d'erreur
Box_convertir.Text = "0"
MessageBox.Show(Me, "Salaire incorrect", "Erreur de saisie", MessageBoxButtons.OK,MessageBoxIcon.Error)
' focus sur champ erroné
Box_convertir.Focus()
' sélection du texte du champ de saisie
Box_convertir.SelectAll()
' retour à l'interface visuelle
Return
End Try 'try-catch |