private void penTxt_TextChanged(object sender, EventArgs e) { int sum = 0; for (int i = 0; i < metroGrid1.Rows.Count - 1; ++i) { sum += Convert.ToInt32(metroGrid1.Rows[i].Cells["quantity"].Value); } if (penTxt.Text == string.Empty && totPenTxt.Text != string.Empty) { totPenTxt.Text = Convert.ToInt32(0).ToString(); } else { int value = Convert.ToInt32(penTxt.Text); int result = value * sum; totPenTxt.Text = result.ToString(); }
totPenTxt.Text = Convert.ToInt32(0).ToString(); // why not just: totPenTxt.Text = "0";
penTxt_TextChanged
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)