teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

_dicListに値をセットする処理はこちらになります。

2016/02/18 03:29

投稿

chi-o-
chi-o-

スコア8

title CHANGED
File without changes
body CHANGED
@@ -25,4 +25,28 @@
25
25
  SetSelectedPrintDocument();
26
26
  p.ShowDialog();
27
27
  }
28
+ ```
29
+
30
+ _dicListに値をセットする処理はこちらになります。
31
+ ```C#
32
+ private void dataGridViewMain_CurrentCellDirtyStateChanged(object sender, EventArgs e) {
33
+ try {
34
+ if (this.dataGridViewMain.CurrentCellAddress.X == CHECKBOX_INDEX && this.dataGridViewMain.IsCurrentCellDirty) {
35
+ this.dataGridViewMain.CommitEdit(DataGridViewDataErrorContexts.Commit);
36
+ }
37
+ }
38
+ }
39
+
40
+ private void dataGridViewMain_CellValueChanged(object sender, DataGridViewCellEventArgs e) {
41
+ if (e.ColumnIndex == CHECKBOX_INDEX && e.RowIndex >= 0) {
42
+ string check = this.dataGridViewMain[CHECKBOX_INDEX, e.RowIndex].Value.ToString();
43
+ string key = this.dataGridViewMain[ID_INDEX, e.RowIndex].Value.ToString();
44
+ if (check == true.ToString()) {
45
+ this._dicList[key] = true;
46
+ }
47
+ else {
48
+ this._dicList[key] = false;
49
+ }
50
+ }
51
+ }
28
52
  ```