private void txt_producto_TextChanged(object sender, EventArgs e) { string P; Program.cod_producto = txt_producto.Text; Program.descripción = c.Obtener_Descripcion_Producto(Program.cod_producto); txt_descripcion.Text = Program.descripción; P = txt_producto.Text; if (Program.descripción != "") { c.proveedor(txt_empresa, P); txt_cantidad.Enabled = true; btn_limpiar.Enabled = true; btn_guardar.Enabled = true; } else { txt_cantidad.Text = ""; txt_empresa.Text = ""; txt_cantidad.Enabled = false; btn_limpiar.Enabled = false; btn_guardar.Enabled = false; } }
//Agregar private void btn_agregar_Click(object sender, EventArgs e) { double cantidadcompara = 0; if (txt_vinventario.Text != "") { if (txt_vcantidad.Text != "") { cantidadcompara = Convert.ToDouble(txt_vcantidad.Text); if (cantidadcompara > 0) { codproducto.Add(txt_vcodigo.Text); cantidad.Add(Convert.ToDouble(txt_vcantidad.Text)); categoria.Add(lbl_vtipo.Text); precio.Add(Convert.ToDouble(txt_vprecio.Text)); sub_total.Add(Convert.ToDouble(txt_importa.Text)); cantida_inventario.Add(Convert.ToDouble(txt_vinventario.Text)); dataGridView1.Rows.Add(txt_vcodigo.Text, c.Obtener_Descripcion_Producto(txt_vcodigo.Text), txt_vcantidad.Text, lbl_vtipo.Text, txt_vprecio.Text, txt_importa.Text); total = total + Convert.ToDouble(txt_importa.Text); txt_vtotal.Text = Convert.ToString(total); txt_vcodigo.Clear(); txt_vcantidad.Clear(); txt_vesxistencia.Clear(); txt_vinventario.Clear(); txt_vprecio.Text = "0"; txt_importa.Clear(); } else { MessageBox.Show("Ingresar una cantidad mayor a cero"); } } else { MessageBox.Show("Faltan datos por ingresar"); } } else { MessageBox.Show("Falta agregar productos"); } txt_vcodigo.Focus(); }