Focus a control of a Windows Form
Shows how to focus a control in a Windows Form.
If you are working with Web forms it is very simple,
you just use "WebControl.Focus()" but this does not
work for Windows Forms...
// A example event: private void btnExampleCommand_Click(object sender, EventArgs e) { // That's all: this.ActiveControl = this.SomeControlObject; // This line focuses a control }
Author:
Jonas John
License:
Public domain
Language:
C#
Created:
08/23/2007
Updated:
08/23/2007
Tags:
example, gui, windows forms
Sorry folks, comments have been deactivated for now due to the large amount of spam.
Please try to post your questions or problems on a related programming board, a suitable mailing list, a programming chat-room,
or use a QA website like stackoverflow because I'm usually too busy to answer any mails related
to my code snippets. Therefore please just mail me if you found a serious bug... Thank you!
Older comments:
you saved my day.
Thanks
:D