Form that reactivates itself

May 25 2009 12:03 AM
I'm trying to create a form that will reactivate itself when deactivated. So far I have tried these methods:


private void Form1_Deactivate(object sender, EventArgs e)
{
SetForegroundWindow(this.Handle.ToInt32());
Activate();
BringToFront();
textBox1.Focus();
}

private void Form1_Leave(object sender, EventArgs e)
{
SetForegroundWindow(this.Handle.ToInt32());
Activate();
BringToFront();
textBox1.Focus();
}



So far none of this has worked. Suggestions? Also, what code tag should I use? I had to break all of that myself.

Answers (4)