private void DG_datos_CellEndEdit(object sender, DataGridViewCellEventArgs e)
 {
     if (!TB_articulo.Focused)
     {
         TB_articulo.Focus();
         //TB_articulo.Text += e.KeyPress;
         // Move el cursor al final
         TB_articulo.SelectionStart = TB_articulo.Text.Length;
     }
 }
Exemple #2
0
        private void TB_articulo_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == Convert.ToChar(Keys.Enter))
            {
                if (TB_articulo.Text.Equals(""))
                {
                    MessageBox.Show("Ingresa un artículo");
                }
                else
                {
                    lblVa.Text  = "";
                    lblRe.Text  = "";
                    lblVe.Text  = "";
                    lblCo.Text  = "";
                    lblPre.Text = "";

                    lblVaPre.Text = "";
                    lblRePre.Text = "";
                    lblVePre.Text = "";
                    lblCoPre.Text = "";
                    lblPre2.Text  = "";

                    DatosProducto();
                    if (CKB_Bodega.Checked == true)
                    {
                        Bodega();
                    }

                    if (CKB_Vallarta.Checked == true)
                    {
                        Vallarta();
                    }

                    if (CKB_Rena.Checked == true)
                    {
                        Rena();
                    }

                    if (CKB_Velazquez.Checked == true)
                    {
                        Velazquez();
                    }

                    if (CKB_Coloso.Checked == true)
                    {
                        Coloso();
                    }

                    if (CKB_Pregot.Checked == true)
                    {
                        Pregot();
                    }
                }
            }

            if (e.KeyChar == Convert.ToChar(Keys.Space))
            {
                borrarArticulo();
                limpiarOferta();
                limpiarPrecio();

                lblVa.Text  = "";
                lblRe.Text  = "";
                lblVe.Text  = "";
                lblCo.Text  = "";
                lblPre.Text = "";

                lblVaPre.Text = "";
                lblRePre.Text = "";
                lblVePre.Text = "";
                lblCoPre.Text = "";
                lblPre2.Text  = "";


                LB_prov_bodega.Text    = "";
                LB_prov_coloso.Text    = "";
                LB_prov_pregot.Text    = "";
                LB_prov_rena.Text      = "";
                LB_prov_vallarta.Text  = "";
                LB_prov_velazquez.Text = "";

                TB_articulo.Focus();
                TB_articulo.SelectAll();
                SendKeys.Send("{BACKSPACE}");
            }
        }