yesubabu k

yesubabu k

  • 1.1k
  • 644
  • 62k

sum of value not showing

Jul 3 2018 2:03 AM
dear sir,
i have a gridview in windows application form in that ihave a checkbox for selecting the row and also its contains Amount field
when i select first checkbox in gridview it is not showing the value at label
here is my code:
 
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
//try
//{
decimal TotalValue = 0.0m;
for (int i = 0; i < dataGridView1.Rows.Count; ++i)
{
if (Convert.ToString(dataGridView1.Rows[i].Cells[0].Value) == "1")
{
TotalValue += decimal.Parse(dataGridView1.Rows[i].Cells[7].Value.ToString());
}
else
{
}
}
lblInvoiceamt.Text = TotalValue.ToString();
//}
//catch (Exception ex)
//{
//}
}
 

Answers (3)