private void TxtPrecioU_TextChanged(object sender, EventArgs e)
 {
     if (TxtPrecioU.Text.Trim().Length > 0)
     {
         POO.AlertNotNumber(TxtPrecioU.Text.Trim());
         TxtPrecioU.Focus();
         return;
     }
 }
        private void BtnIngresar_Click(object sender, EventArgs e)
        {
            if (TxtProducto.Text.Trim().Length == 0)
            {
                MessageBox.Show("Ingrese la Descripción del Producto.");
                TxtProducto.Focus();
                return;
            }

            if (TxtCantidadP.Text.Trim().Length == 0)
            {
                MessageBox.Show("Ingrese La Cantidad de Productos.");
                TxtCantidadP.Focus();
                return;
            }

            if (TxtPrecioU.Text.Trim().Length == 0)
            {
                MessageBox.Show("Ingrese el Precio Unitario.");
                TxtPrecioU.Focus();
                return;
            }

            LsbDescripcion.Items.Add(TxtProducto.Text.Trim());
            LsbCant.Items.Add(TxtCantidadP.Text.Trim());
            LsbPrec.Items.Add(TxtPrecioU.Text.Trim());


            double cant, prec, mont, sumt;

            sumt = 0;

            cant = Convert.ToDouble(TxtCantidadP.Text);
            prec = Convert.ToDouble(TxtPrecioU.Text);

            mont = cant * prec;

            LsbMonto.Text = mont.ToString();
            LsbMonto.Items.Add(mont);

            TxtProducto.Clear();
            TxtCantidadP.Clear();
            TxtPrecioU.Clear();
            TxtProducto.Focus();

            contador++;
            LblDescripcion.Text = "Ingresar La Descripción del Producto # " + contador.ToString() + ": ";

            sumt         += mont;
            TxtPagar.Text = sumt.ToString();
        }
        private void BtnAgregar_Click(object sender, EventArgs e)
        {
            if (TxtCodigo.Text.Trim().Length == 0)
            {
                POO.MsgWarning("El Campo Codigo Es Requerido.");
                TxtCodigo.Focus();
                return;
            }
            if (TxtProducto.Text.Trim().Length == 0)
            {
                POO.MsgWarning("El Campo Decripción Es Requerido.");
                TxtProducto.Focus();
                return;
            }
            if (TxtCantidad.Text.Trim().Length == 0)
            {
                POO.MsgWarning("El Campo Cantidad Es Requerido.");
                TxtCantidad.Focus();
                return;
            }
            if (TxtPrecioU.Text.Trim().Length == 0)
            {
                POO.MsgWarning("El Campo Precio Unitario Es Requerido.");
                TxtPrecioU.Focus();
                return;
            }

            DataGridViewRow fila = new DataGridViewRow();

            fila.CreateCells(DgvFactura);
            fila.Cells[0].Value = TxtCodigo.Text.Trim();
            fila.Cells[1].Value = TxtProducto.Text.Trim();
            fila.Cells[2].Value = TxtCantidad.Text.Trim();
            fila.Cells[3].Value = TxtPrecioU.Text.Trim();

            double prec, cant;

            prec = Convert.ToDouble(TxtPrecioU.Text.Trim());
            cant = Convert.ToDouble(TxtCantidad.Text.Trim());

            fila.Cells[4].Value = POO.precU(prec, cant).ToString();

            DgvFactura.Rows.Add(fila);

            TxtCodigo.Clear();
            TxtProducto.Clear();
            TxtCantidad.Clear();
            TxtPrecioU.Clear();
            TxtCodigo.Focus();
        }