Why are grid view cells automatically adding 0 at the foot of subtotal grid view?
int qty = 0;
int amount = 0;
int rowtotal = 0;
int subtotal = 0;
int total = 0;
foreach (DataGridViewRow row in itemgridview.Rows)
{
qty = Convert.ToInt32(row.Cells[1].Value);
amount = Convert.ToInt32(row.Cells[2].Value);
rowtotal = qty * amount;
row.Cells[3].Value = rowtotal;
subtotal += rowtotal;
}
total = subtotal;
txtordertotal.Text = total.ToString();
Make
AllowUsersToAddRow = falseand then try again.this property will remove the extra row.