Browse files

修正DataGridView单元格数据类型错误

  • Loading branch information...
1 parent a3d0fee commit a3e853c2a6851d9da002447740861d25b76be811 Advansil committed Apr 13, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 ExcelApplication/ExcelApplication/Form1.cs
View
8 ExcelApplication/ExcelApplication/Form1.cs
@@ -60,7 +60,7 @@ public bool dataTotal(int col)
if (tempD == 0)
dataGridView1.Rows[j].Cells[13].Value = "0";
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)
@@ -72,7 +72,7 @@ public bool dataTotal(int col)
if (tempD == 0)
dataGridView1.Rows[j].Cells[i].Value = "0";
else
- dataGridView1.Rows[j].Cells[i].Value = tempC * 10000 / tempD / 100.0;
+ dataGridView1.Rows[j].Cells[i].Value = (tempC * 10000 / tempD / 100.0).ToString();
}
}
}
@@ -262,7 +262,7 @@ private void removeColumnToolStripMenuItem_Click(object sender, EventArgs e)
if (tempA == 0)
dataGridView1.Rows[j].Cells[13].Value = "0";
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)
@@ -274,7 +274,7 @@ private void removeColumnToolStripMenuItem_Click(object sender, EventArgs e)
if (tempA == 0)
dataGridView1.Rows[j].Cells[i].Value = "0";
else
- dataGridView1.Rows[j].Cells[i].Value = tempB * 10000 / tempA/100.0;
+ dataGridView1.Rows[j].Cells[i].Value = (tempB * 10000 / tempA/100.0).ToString();
}
}
}

0 comments on commit a3e853c

Please sign in to comment.