c# set focus on process code example
Example 1: c# control focus event
private void Control1_GotFocus(Object sender, EventArgs e) {
MessageBox.Show("You are in the Control.GotFocus event.");
}
Example 2: c# control lost focus event
// This method handles the LostFocus event for textBox1 by setting the
// dialog's InitialDirectory property to the text in textBox1.
private void textBox1_LostFocus(object sender, System.EventArgs e)
{
openFileDialog1.InitialDirectory = textBox1.Text;
}