Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. private void txtBoxMatricule_Validating(object sender, CancelEventArgs e)
  2. {
  3. try
  4. {
  5. int valeur = Int32.Parse(txtBoxMatricule.Text);
  6. if (valeur < 0)
  7. {
  8. GestionnaireErreur.SetError(txtBoxMatricule, "Pas un nombre entier positif.");
  9. }
  10. for (int i = 0; i<GestionDesStagiaires.dataGridView1.Rows.Count; i++)
  11. {
  12. if (GestionDesStagiaires.dataGridView1.GetCellDisplayRectangle(0, i, true) == Int32.Parse(txtBoxMatricule.Text))
  13. {
  14. GestionnaireErreur.SetError(txtBoxMatricule, "Ce matricule existe deja!!!");
  15. }
  16. }
  17. GestionnaireErreur.SetError(txtBoxMatricule, "");
  18.  
  19. }
  20. catch (Exception)
  21. {
  22. GestionnaireErreur.SetError(txtBoxMatricule, "Pas un nombre entier.");
  23.  
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement