habib ullah

habib ullah

  • NA
  • 229
  • 14.1k

object cannot be cast from dbnull to other types

May 15 2017 3:22 AM
when we run the program then show the following error
object cannot be cast from dbnull to other types 
i vahe calculate the datagraid view cell
int sum = 0;
for (int a = 0; a < dataGridView1.Rows.Count; a++)
{
sum += Convert.ToInt32(dataGridView1.Rows[a].Cells[2].Value);
}
label5.Text= sum.ToString();
}
 
 

Answers (4)