private void OrderDataGridView_RowsAdded(object sender, System.Windows.Forms.DataGridViewRowsAddedEventArgs e) { string value; int newPrice = 0; int totalSumPrice = 0; if (e.RowIndex != -1) { if (orderDataGridView.RowCount >= 1) { for (int i = 0; i < orderDataGridView.Rows.Count; i++) { value = orderDataGridView.Rows[i].Cells[3].Value.ToString().Replace("تومان", string.Empty).Trim(); newPrice = int.Parse(value.Replace(",", string.Empty).Trim()); totalSumPrice += newPrice; } value = $"{totalSumPrice.ToString("#,0")} تومان"; totalPrice.Text = value; } else { return; } } else { return; } }
private void BloodListdataGridView_RowsAdded(object sender, System.Windows.Forms.DataGridViewRowsAddedEventArgs e) { CheckRecord(); }