4
What code should be used to focus a Textbox?
I am creating a system, where I need that when the client keystrokes ESC, the focus of the textbox is lost.
How do I do?
4
What code should be used to focus a Textbox?
I am creating a system, where I need that when the client keystrokes ESC, the focus of the textbox is lost.
How do I do?
6
You need some other focusable control
to change the Focus, you can set to a label
, for example:
private void key_pressed(object sender, KeyPressed e)
{
this.ActiveControl = label1;
}
or for a NULL
private void key_pressed(object sender, KeyPressed e)
{
this.ActiveControl = NULL;
}
4
It is possible to do this two ways:
It is also possible to change the active control of the form for null
.
this.ActiveControl = null;
Browser other questions tagged c# winforms
You are not signed in. Login or sign up in order to post.
would that you want:
textbox.Focused = false;
?– gato
no, the property
Focused
It’s read-only, I can’t change it– Italo Rodrigo