المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Activating a child form



C# Programming
12-05-2009, 10:24 PM
I am writing a program that is going to be operated with an IR controller. In the program Form1 creates a new form Form2.

Form2 dlg = new Form2(fname);
if (dlg.ShowDialog() == DialogResult.OK)
{

}

Unfortunatly the new form will not receive input unless I click on it with the mouse to make it active. I have tried various commands but in order to make the new form receive the IR commands I must click on the form with the mouse. How can I activate the form programatically.

public Form2(string temp)
{
InitializeComponent();
//this.Focus(); // Tried these
//this.Activate();
//this.BringToFront();
}