double Final = 0; //decimal Serial = Convert.ToInt32(dataGridView1.Rows[i].Cells[0].Value); decimal Quantity = Convert.ToDecimal(dataGridView1.Rows[i].Cells[2].Value); decimal Rate = Convert.ToDecimal(dataGridView1.Rows[i].Cells[3].Value); decimal vat = Convert.ToDecimal(dataGridView1.Rows[i].Cells[4].Value); decimal TotalPrice = Convert.ToInt32(Quantity * Rate); decimal TempVatTax = TotalPrice * Convert.ToDecimal(dataGridView1.Rows[i].Cells[4].Value) / 100; TotalPrice = TempVatTax + TotalPrice; dataGridView1.Rows[i].Cells[5].Value = TotalPrice; Final = Convert.ToDouble(TotalPrice); //Final=Convert.ToDouble(txt_Total.Text+Final); //Final += CInt(row.Cells(0).Text); txt_Total.Text = Convert.ToString(Final); }
Rows[i]
Final = Convert.ToDouble(TotalPrice);
Final += Convert.ToDouble(TotalPrice);
double LastTotal=0; double Final = 0; //decimal Serial = Convert.ToInt32(dataGridView1.Rows[i].Cells[0].Value); decimal Quantity = Convert.ToDecimal(dataGridView1.Rows[i].Cells[0].Value); decimal Rate = Convert.ToDecimal(dataGridView1.Rows[i].Cells[1].Value); decimal vat = Convert.ToDecimal(dataGridView1.Rows[i].Cells[2].Value); decimal TotalPrice = Convert.ToInt32(Quantity * Rate); decimal TempVatTax = TotalPrice * Convert.ToDecimal(dataGridView1.Rows[i].Cells[3].Value) / 100; TotalPrice = TempVatTax + TotalPrice; dataGridView1.Rows[i].Cells[4].Value = TotalPrice; Final = Convert.ToDouble(TotalPrice); //Add this Code to your COde Editor if (txt_Total.Text != "") { LastTotal = Convert.ToDouble(txt_Total.Text); } txt_Total.Text = Convert.ToString(Final+LastTotal);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)