Guest User

Untitled

a guest
Jan 23rd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. public void Validate_Month(DataGridView dataGridView, int month, int select)
  2. {
  3. decimal num;
  4.  
  5. if (dataGridView.ColumnCount > 3)
  6. {
  7. for (int h = select; h <= month; h++)
  8. {
  9. for (int i = 0; i < dataGridView.RowCount; i++)
  10. {
  11. if (!Decimal.TryParse(dataGridView[h, i].Value.ToString(), out num))
  12. {
  13. if (dataGridView[h, i].Value.ToString() == null || dataGridView[h, i].Value.ToString() == "")
  14. {
  15.  
  16. }
  17. else
  18. {
  19. MessageBox.Show("Row not decimal:" + " [ " + dataGridView[h, i].Value.ToString() + "] in column " + dataGridView.Columns[h].Name);
  20. }
  21. }
  22. }
  23. }
  24. }
  25. }
  26. }
  27.  
  28. public void Validate_Month(DataGridView dataGridView, int month, int select)
  29. {
  30. decimal num;
  31. StringBuilder sb =new StringBuilder();
  32. if (dataGridView.ColumnCount > 3)
  33. {
  34. for (int h = select; h <= month; h++)
  35. {
  36. for (int i = 0; i < dataGridView.RowCount; i++)
  37. {
  38. if (!Decimal.TryParse(dataGridView[h, i].Value.ToString(), out num))
  39. {
  40. if (dataGridView[h, i].Value.ToString() == null || dataGridView[h, i].Value.ToString() == "")
  41. {
  42.  
  43. }
  44. else
  45. {
  46. sb.AppendLine("Row not decimal:" + " [ " + dataGridView[h, i].Value.ToString() + "] in column " + dataGridView.Columns[h].Name);
  47. }
  48. }
  49. }
  50. }
  51. }
  52.  
  53. MessageBox.Show(sb.ToString());
  54. }
Add Comment
Please, Sign In to add comment