Beispiel #1
0
        private void txt_codigo_produto_KeyPress(object sender, KeyPressEventArgs e)
        {
            //Se a tecla digitada não for número e nem backspace
            if (!char.IsDigit(e.KeyChar) && e.KeyChar != 13 && e.KeyChar != 08 && e.KeyChar != 42 && e.KeyChar != 44)
            {
                //Atribui True no Handled para cancelar o evento
                e.Handled = true;
            }

            if (e.KeyChar == 13)
            {
                try
                {
                    if (txt_codigo_produto.Text == "")
                    {
                        var buscarProdutoPorNome = new Frm_seleciona_produto(this, txt_codigo_produto.Text);
                        buscarProdutoPorNome.Show();
                    }
                    else
                    {
                        InserirProdutoCarrinho(txt_codigo_produto.Text);
                    }
                }
                catch (Exception ex)
                {
                    LimparTextbox(this);
                }
            }
        }
Beispiel #2
0
 public void AbrirFormSelecionarProduto()
 {
     try
     {
         var SelecionaProduto = new Frm_seleciona_produto(this, txt_codigo_produto.Text);
         SelecionaProduto.Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Houve uma falha ao montar tela \n" + ex.Message, "Messagem", MessageBoxButtons.OK, MessageBoxIcon.Error);
         LimparTextbox(this);
     }
 }