private void btnAgregar_Click(object sender, EventArgs e) { if (txtCantidad.Text == "0") { MessageBox.Show("Ingrese un numero mayor a 0"); return; } if (!string.IsNullOrEmpty(txtdescripcion.Text) == false) { MessageBox.Show("Seleccione un Servicio"); return; } if (!string.IsNullOrEmpty(txtCantidad.Text) == false) { MessageBox.Show("Seleccione una Cantidad"); return; } if (Base_de_datos.ValidarFacturaDetalle(lblCodigoFacturaSer.Text, a.ToString()) == 1) { Base_de_datos.Detalle_Servicio(int.Parse(lblCodigoFacturaSer.Text), CodigoS, int.Parse(txtCantidad.Text)); Base_de_datos busc = new Base_de_datos(); busc.BuscarDetalle(lblCodigoFacturaSer.Text); dataGridView2.DataSource = busc.Mostrar_Resultados(); btnGuardar.Enabled = true; a = int.Parse(dataGridView2[1, 0].Value.ToString()); } else { MessageBox.Show("Servicio ya Ingresado"); } }