Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void txtBoxMatricule_Validating(object sender, CancelEventArgs e)
- {
- try
- {
- int valeur = Int32.Parse(txtBoxMatricule.Text);
- if (valeur < 0)
- {
- GestionnaireErreur.SetError(txtBoxMatricule, "Pas un nombre entier positif.");
- }
- for (int i = 0; i<GestionDesStagiaires.dataGridView1.Rows.Count; i++)
- {
- if (GestionDesStagiaires.dataGridView1.GetCellDisplayRectangle(0, i, true) == Int32.Parse(txtBoxMatricule.Text))
- {
- GestionnaireErreur.SetError(txtBoxMatricule, "Ce matricule existe deja!!!");
- }
- }
- GestionnaireErreur.SetError(txtBoxMatricule, "");
- }
- catch (Exception)
- {
- GestionnaireErreur.SetError(txtBoxMatricule, "Pas un nombre entier.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement