private void flowLayoutPanel3_Click(object sender, EventArgs e) { inventario obj = new inventario(); obj.button2.Visible = false; obj.btnAdd.Visible = false; String dato = ""; if (obj.ShowDialog() == DialogResult.OK) { dato = obj.dataGridViewProducto.Rows[obj.dataGridViewProducto.CurrentCell.RowIndex].Cells[1].Value.ToString(); } if (!dato.Equals("")) { DataSet DS = new DataSet(); DS = SearchEnter(dato); if (DS.Tables.Count > 0) { textBox3.Text = dato; txtNomPro.Text = DS.Tables[0].Rows[0]["nom_pro"].ToString(); txtPrePro.Text = DS.Tables[0].Rows[0]["precio"].ToString(); cantidadPro = Convert.ToInt32(DS.Tables[0].Rows[0]["cantidad"].ToString()); itbisPro = Convert.ToInt32(DS.Tables[0].Rows[0]["itbis"].ToString()); idProSelect = DS.Tables[0].Rows[0]["id_pro"].ToString(); } } }
private void txt_codigoCliente_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == Convert.ToChar(Keys.Enter)) { try { inventario pro = new inventario(); pro.btnAdd.Visible = false; pro.button2.Visible = false; if (pro.ShowDialog() == DialogResult.OK) { idPro = pro.dataGridViewProducto.Rows[pro.dataGridViewProducto.CurrentCell.RowIndex].Cells[0].Value.ToString(); txt_codigoPro.Text = pro.dataGridViewProducto.Rows[pro.dataGridViewProducto.CurrentCell.RowIndex].Cells[1].Value.ToString(); txt_nombrePro.Text = pro.dataGridViewProducto.Rows[pro.dataGridViewProducto.CurrentCell.RowIndex].Cells[2].Value.ToString(); txt_precioPro.Text = pro.dataGridViewProducto.Rows[pro.dataGridViewProducto.CurrentCell.RowIndex].Cells[6].Value.ToString(); impuestoPro = Convert.ToDouble(pro.dataGridViewProducto.Rows[pro.dataGridViewProducto.CurrentCell.RowIndex].Cells[4].Value.ToString()); maximaCant = Convert.ToInt32(pro.dataGridViewProducto.Rows[pro.dataGridViewProducto.CurrentCell.RowIndex].Cells[3].Value.ToString()); } } catch (Exception) { MessageBox.Show("Erro al traer el producto, por favor intente de nuevo."); } } }