private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) { this.dataGridView1.Rows[e.RowIndex].Cells["Column1"].Value = (e.RowIndex + 1).ToString(); //--------------------for SUM------------------- int sum = 0; for(int i = 0; i < dataGridView1.Rows.Count-1; ++i) { sum =sum+int.Parse(dataGridView1.Rows[i].Cells[12].Value.ToString()); } textBox23.Text = sum.ToString(); }
when i put cell[13] which is quantity and simple degit (For example 5 etc) it works properly and when i put cell[12] which is value (for Example 12.52 etc) i am geting error.
"
An exception of type 'System.FormatException' occurred in mscorlib.dll but was not handled in user code
please help me....
"