Comment en peut-il nommé une exception vb ?

twix2010 Messages postés 13 Date d'inscription   Statut Membre Dernière intervention   -  
Polux31 Messages postés 6917 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,

créer une exception nommeé erreurage qui se déclenche lors de la saisie d un age négatif :


CLASSE :

Public Sub New( ByVal n As String, ByVal p As String, ByVal a As Integer)

Me.nom = n
Me.prenom = p

If a <= 0 Then
Throw New Exception(" age n'est pa valide ")
Else
Me.age = a
End If
cpt = cpt + 1
End Sub


MODULE :

Try
listformateur.Add(New formateur(T1.Text, T2.Text, T3.Text, a, T4.Text, T5.Text))
Catch ex As Exception
MsgBox("age négative")
End Try

1 réponse

Polux31 Messages postés 6917 Date d'inscription   Statut Membre Dernière intervention   1 204
 
Bonjour,

Et la question est ?

Pour info : Lire ici

On n'est pas des robots...
0