int i = 0;
foreach (DataGridViewRow dgvr in itemgridview.Rows)
{
if (dgvr.IsNewRow)
{
}
else
{
int j = 0;
if (int.TryParse(dgvr.Cells[3].Value + "", out j))
{
i += j;
}
else
{
MessageBox.Show("wrong value at row " + (dgvr.Index + 1));
return;
}
}
}
txtordertotal.Text = i.ToString();