Public Class FrmBilanID Dim court As Integer Private Sub FrmBilanID_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Tag = "Bilan individuel" Me.Text = Me.Tag & " |" & TimeOfDay Call generator(CBNP) End Sub Private Sub CmdAnnul_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdAnnul.Click If Boule Then End Else Me.Close() FrmAccueil.Show() End If End Sub Private Sub CmdBM_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdBM.Click Me.Close() FrmBilanMat.Show() End Sub Private Sub CmdBS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdBS.Click Me.Close() FrmBilanSupp.Show() End Sub Private Sub CmdAff_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdAff.Click REM Récupère la clef a regarder + sécurités If RBId.Checked Then If TxtId.Text = "" Then REM Obligation de tester la présence de chiffre avant affectation. MsgBox("La saisie du numéro d'inscription n'a pas été effectuée.", MsgBoxStyle.Exclamation, "Champ vide") TxtId.Focus() Else court = TxtId.Text If court >= ClefMAX Or court <= 1 Then REM regarde si le numéro du candidat est bien déjà existant. MsgBox("L'identifiant que vous avez saisie n'est pas valide.", MsgBoxStyle.Exclamation, "Candidat introuvable") TxtId.Focus() Else If Tindex(court - 2).Suppr Then REM Il faut aussi vérifier que c'est un candidat non supprimé. MsgBox("Ce candidat a été supprimé.", MsgBoxStyle.Exclamation, "Candidat indisponible") TxtId.Focus() Else Call PrepareInfo(court) End If End If End If End If End Sub Private Sub CBNP_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles CBNP.KeyPress CBNP.FindString(CBNP.Text) End Sub Private Sub CBNP_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CBNP.SelectedIndexChanged If RBNP.Checked Then If CBNP.SelectedIndex = -1 Then REM ce cas ne dervais jamais se produire. MsgBox("La saisie du candidat n'a pas été effectuée.", MsgBoxStyle.Exclamation, "Champ vide") CBNP.Focus() Else If IsNumeric(Microsoft.VisualBasic.Right(CBNP.SelectedItem, 2)) Then REM court = Microsoft.VisualBasic.Right(CBNP.SelectedItem, 2) End If Call PrepareInfo(court) End If End If End Sub Sub PrepareInfo(ByVal court As Integer) 'If erreur = False Then FileGet(nf, cddts, court) REM Prépare la première partie LblNP.Text = cddts.Nom & ", " & cddts.Prenom LblAdrss.Text = cddts.Adresse LblCPV.Text = cddts.CP & ", " & cddts.Ville Dim agea As Integer Dim agem As Integer Dim naiss As Integer agem = cddts.Age Mod 12 agea = cddts.Age \ 12 naiss = (auj - cddts.Age) \ 12 LblAge.Text = Format(agem, "00") & "/" & agea & " (" & naiss & " ans)" REM Prépare la listebox a partir de cddts. LBexam.Items.Clear() Dim i As Integer = 0 LBexam.Items.Add("Centre :") LBexam.Items.Add(" " & treg(cddts.Region)) LBexam.Items.Add(" ") LBexam.Items.Add("Ecrits :") For i = 0 To UbdE LBexam.Items.Add(" " & tme(cddts.Ecrit(i))) Next LBexam.Items.Add(" ") LBexam.Items.Add("Oraux :") For i = 0 To UbdO LBexam.Items.Add(" " & tme(cddts.Oral(i))) Next LBexam.Items.Add(" ") If cddts.Fac >= 0 Then LBexam.Items.Add("Examen facultatif :") LBexam.Items.Add(" " & tme(cddts.Fac)) LBexam.Items.Add(" ") End If 'End If End Sub Private Sub CBNP_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles CBNP.GotFocus RBNP.Checked = True End Sub Private Sub TxtId_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TxtId.GotFocus RBId.Checked = True End Sub Private Sub TxtId_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TxtId.KeyPress If e.KeyChar = vbBack Then Exit Sub End If If e.KeyChar < "0" Or e.KeyChar > "9" Then REM On peut utiliser aussi Not IsNumeric() e.KeyChar = Chr(0) End If End Sub End Class