Guest User

Untitled

a guest
Apr 29th, 2012
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. C#: DataGridViewCheckBoxCell strange behaviour
  2. foreach (string pre in preselect)
  3. {
  4. foreach (DataGridViewRow row in dgvProtFunc.Rows)
  5. {
  6. if ((string)row.Cells[2].Value == pre)
  7. {
  8. ((DataGridViewCheckBoxCell)row.Cells[0]).Value = true;
  9. }
  10. }
  11. }
  12.  
  13. private void dgvProtFunc_CurrentCellDirtyStateChanged(object sender, EventArgs e)
  14. {
  15. if (dgvProtFunc.IsCurrentCellDirty)
  16. {
  17. dgvProtFunc.CommitEdit(DataGridViewDataErrorContexts.Commit);
  18. }
  19. }
  20.  
  21. private void dgvProtFunc_CellValueChanged(object sender, DataGridViewCellEventArgs e)
  22. {
  23. if (!FormLoadCheck)
  24. {
  25. string data = string.Empty;
  26. ptSelectList.Clear();
  27. foreach (DataGridViewRow row in dgvProtFunc.Rows)
  28. {
  29. if (row.Cells[0].Value != null && Convert.ToBoolean(row.Cells[0].Value) == true)
  30. {
  31. ptSelectList.Add(Convert.ToInt32(row.Cells[1].Value));
  32. }
  33. data += row.Cells[0].Value;
  34. }
  35. ptSelectList.Sort();
  36. FilterRelais(ptSelectList.ToArray());
  37. MessageBox.Show(data);
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment