Skip to content

Commit

Permalink
修正DataGridView单元格数据类型错误
Browse files Browse the repository at this point in the history
  • Loading branch information
Advansil committed Apr 13, 2012
1 parent a3d0fee commit a3e853c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ExcelApplication/ExcelApplication/Form1.cs
Expand Up @@ -60,7 +60,7 @@ public bool dataTotal(int col)
if (tempD == 0) if (tempD == 0)
dataGridView1.Rows[j].Cells[13].Value = "0"; dataGridView1.Rows[j].Cells[13].Value = "0";
else else
dataGridView1.Rows[j].Cells[13].Value = tempC * 10000 / tempD / 100.0; dataGridView1.Rows[j].Cells[13].Value = (tempC * 10000 / tempD / 100.0).ToString();
} }


for (int i = 15; i < 50; i += 2) for (int i = 15; i < 50; i += 2)
Expand All @@ -72,7 +72,7 @@ public bool dataTotal(int col)
if (tempD == 0) if (tempD == 0)
dataGridView1.Rows[j].Cells[i].Value = "0"; dataGridView1.Rows[j].Cells[i].Value = "0";
else else
dataGridView1.Rows[j].Cells[i].Value = tempC * 10000 / tempD / 100.0; dataGridView1.Rows[j].Cells[i].Value = (tempC * 10000 / tempD / 100.0).ToString();
} }
} }
} }
Expand Down Expand Up @@ -262,7 +262,7 @@ private void removeColumnToolStripMenuItem_Click(object sender, EventArgs e)
if (tempA == 0) if (tempA == 0)
dataGridView1.Rows[j].Cells[13].Value = "0"; dataGridView1.Rows[j].Cells[13].Value = "0";
else else
dataGridView1.Rows[j].Cells[13].Value = tempB* 10000 / tempA/100.0; dataGridView1.Rows[j].Cells[13].Value = (tempB* 10000 / tempA/100.0).ToString();
} }


for (int i = 15; i < 50; i += 2) for (int i = 15; i < 50; i += 2)
Expand All @@ -274,7 +274,7 @@ private void removeColumnToolStripMenuItem_Click(object sender, EventArgs e)
if (tempA == 0) if (tempA == 0)
dataGridView1.Rows[j].Cells[i].Value = "0"; dataGridView1.Rows[j].Cells[i].Value = "0";
else else
dataGridView1.Rows[j].Cells[i].Value = tempB * 10000 / tempA/100.0; dataGridView1.Rows[j].Cells[i].Value = (tempB * 10000 / tempA/100.0).ToString();
} }
} }
} }
Expand Down

0 comments on commit a3e853c

Please sign in to comment.