Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- Private Sub btnQuitter_Click(sender As Object, e As EventArgs) Handles btnQuitter.Click
- End
- End Sub
- Private Sub btnAfficher_Click(sender As Object, e As EventArgs) Handles btnAfficher.Click
- If txtNAM.Text.Length = 12 Then
- Dim lettre As String = txtNAM.Text.Substring(0, 4)
- Dim annee As String = txtNAM.Text.Substring(4, 4)
- Dim mois As String = txtNAM.Text.Substring(8, 2)
- Dim jour As String = txtNAM.Text.Substring(10, 2)
- Dim booLettre As Boolean = True
- For Each elem In lettre
- If Not Char.IsLetter(elem) Then
- booLettre = False
- End If
- Next
- If booLettre = False Then
- MsgBox("Il manque un caractère. Vous devez inscrire les 3 premier caractère de votre nom de famille et la première lettre de votre prénom", MsgBoxStyle.Exclamation, "Erreur")
- End If
- If CInt(annee) < 1920 Or CInt(annee) > 2017 Then
- MsgBox("L'année de naissance doit être entre 1920 et 2017", MsgBoxStyle.Exclamation, "Erreur")
- End If
- If CInt(mois) < 1 Or CInt(mois) > 12 Then
- MsgBox("Le mois de naissance est invalide", MsgBoxStyle.Exclamation, "Erreur")
- End If
- Select Case CInt(mois)
- Case 1, 3, 5, 7, 8, 10, 12
- If CInt(jour) > 31 Or CInt(jour) < 0 Then
- MsgBox("Le jour de naissance est invalide", MsgBoxStyle.Exclamation, "Erreur")
- End If
- Case 2
- If CInt(jour) > 28 Or CInt(jour) < 0 Then
- MsgBox("Le jour de naissance est invalide", MsgBoxStyle.Exclamation, "Erreur")
- End If
- Case Else
- If CInt(jour) > 30 Or CInt(jour) < 0 Then
- MsgBox("Le jour de naissance est invalide", MsgBoxStyle.Exclamation, "Erreur")
- End If
- End Select
- Else
- MsgBox("Le Numéro d'assurance maladie est invalide", MsgBoxStyle.Exclamation, "Erreur")
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement