Я хочу добавить символ к сфокусированному texbox в winform c#
. Как я могу это сделать ? на самом деле я хочу контролировать e.KeyChar
в myform_KeyPress
событие.
private void add_user_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\r' && hidden_scan_textbox.Text != "")
{
shomare_shenasai_view.Text = hidden_scan_textbox.Text;
hidden_scan_textbox.Text = "";
}
if (e.KeyChar != '\r')
{
hidden_scan_textbox.Text += e.KeyChar;
//here i want to add e.KeyChar to focused texbox
e.KeyChar = '\0';
}
}