Comment en peut-il nommé une exception vb ?
twix2010
Messages postés
16
Statut
Membre
-
Polux31 Messages postés 7219 Statut Membre -
Polux31 Messages postés 7219 Statut Membre -
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
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
A voir également:
- Comment en peut-il nommé une exception vb ?
- Nommez une application d'appel vidéo ou de visioconférence - Guide
- Appliquez à tous les paragraphes du document à télécharger, à l’exception des titres et des sous-titres, la mise en forme suivante : - Guide
- Vb - Télécharger - Langages
- Gaston a entièrement vidé la corbeille de son ordinateur qui contenait pourtant des documents importants. il ne possède aucune sauvegarde de son ordinateur. nommez un logiciel qu'il peut utiliser pour tenter de retrouver ses documents. ✓ - Forum Windows
- L'exception exception logicielle inconnue 0xe0000008 ✓ - Forum PC fixe