Good morning, I have a problem with my textbox. I have the focus for one in specific but when I try to diguitar in the others I am activated in which I have the focus. How can I make the textbox that I have focus only activate when I scan (because that's the only reason I'm using it)? This is my code.
private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
if (!txtescaner.Focused)
{
txtescaner.Focus();
txtescaner.Text += e.KeyChar;
// Move el cursor al final
txtescaner.SelectionStart = txtescaner.Text.Length;
if (Char.IsNumber(e.KeyChar) || (char.IsSymbol(e.KeyChar)))
{
e.Handled = false;
}
else if (Char.IsLetter(e.KeyChar))
{
MessageBox.Show("Solo se permiten numeros", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
e.Handled = true;
txtescaner.Clear();
return;
}
}
}
Thank you.