void Button4Click(object sender, EventArgs e) { LoginMySql buscar = new LoginMySql(); MySqlDataReader reader = buscar.buscarProductoPorId(textBox2.Text.Trim()); CantidadProducto cant = new CantidadProducto(); cant.Owner = this; cant.ShowDialog(); int cantidad = cant.Cantidad(); while(reader.Read()) { this.dataGridView1.Rows.Add(reader.GetValue(0), cantidad, reader.GetValue(1), reader.GetValue(2)); this.total += ((Convert.ToSingle(reader.GetValue(2))) * cantidad); label4.Text = total.ToString(); label7.Text = (total*0.16).ToString(); label8.Text = (total+(total*0.16)).ToString(); } textBox2.Text = ""; }
void Button4Click(object sender, EventArgs e) { LoginMySql buscar = new LoginMySql(); MySqlDataReader reader = buscar.buscarProductoPorId(textBox2.Text.Trim()); CantidadProducto cant = new CantidadProducto(); cant.Owner = this; cant.ShowDialog(); int cantidad = cant.Cantidad(); while (reader.Read()) { this.dataGridView1.Rows.Add(reader.GetValue(0), cantidad, reader.GetValue(1), reader.GetValue(2)); this.total += ((Convert.ToSingle(reader.GetValue(2))) * cantidad); label4.Text = total.ToString(); label7.Text = (total * 0.16).ToString(); label8.Text = (total + (total * 0.16)).ToString(); } textBox2.Text = ""; }