Browse Source

Merge remote-tracking branch 'refs/remotes/origin/master'

章政 8 years ago
parent
commit
4c0c2d6c72

+ 9 - 2
UAS-MES/CustomControl/DataGrid_View/DataGridViewWithCheckBox.cs

@@ -22,9 +22,16 @@ namespace UAS_MES.CustomControl.DataGrid_View
             {
                 if (!(Columns[e.ColumnIndex] is DataGridViewCheckBoxColumn) && !(Columns[e.ColumnIndex] is DataGridViewComboBoxColumn))
                 {
-                    if (Rows[e.RowIndex].Cells[0].Value.ToString() == "0")
+                    if (Rows[e.RowIndex].Cells[0].Value != null)
                     {
-                        Rows[e.RowIndex].Cells[0].Value = 1;
+                        if (Rows[e.RowIndex].Cells[0].Value.ToString() == "0")
+                        {
+                            Rows[e.RowIndex].Cells[0].Value = 1;
+                        }
+                        else
+                        {
+                            Rows[e.RowIndex].Cells[0].Value = 0;
+                        }
                     }
                     else
                     {

+ 10 - 4
UAS-MES/CustomControl/DataGrid_View/DataGridViewWithSerialNum.cs

@@ -31,12 +31,18 @@ namespace UAS_MES.CustomControl.DataGrid_View
             {
                 if (!(Columns[e.ColumnIndex] is DataGridViewCheckBoxColumn)&&!(Columns[e.ColumnIndex] is DataGridViewComboBoxColumn))
                 {
-                    if (Rows[e.RowIndex].Cells[0].Value.ToString() == "0")
+                    if (Rows[e.RowIndex].Cells[0].Value != null)
                     {
-                        Rows[e.RowIndex].Cells[0].Value = 1;
+                        if (Rows[e.RowIndex].Cells[0].Value.ToString() == "0")
+                        {
+                            Rows[e.RowIndex].Cells[0].Value = 1;
+                        }
+                        else
+                        {
+                            Rows[e.RowIndex].Cells[0].Value = 0;
+                        }
                     }
-                    else
-                    {
+                    else {
                         Rows[e.RowIndex].Cells[0].Value = 0;
                     }
                 }