G
Guest
I want to have 3 forms open modally. They are 1: a background form (bgform);
2: form_x; 3: loginform. bgform is always open. form_x could be any random
form that that bgform has shown modally. Whenever, the pc is idle for x
minutes then loginform is displayed. This all works fine, except that
loginform does not seem to be a child of form_x. Hence I am able to interact
with form_x. I want the focus to be on loginform until it is closed. here is
my code.
public partial class bgform : Form
{
private void someFunction (......)
{
Form_x form_x = new Form_x();
form_x.ShowDialog();
................
//loginform is activated by idle time
LoginForm loginForm = new LoginForm();
loginForm.ShowDialog();
loginForm.TopMost = true;
loginForm.Parent = form_x;
.................
.................
}
}
//currentForm.Visible = false;
loginForm.ShowDialog();
loginForm.Parent = currentForm;
loginForm.TopMost = true;
//MessageBox.Show(currentForm.Name);
}
2: form_x; 3: loginform. bgform is always open. form_x could be any random
form that that bgform has shown modally. Whenever, the pc is idle for x
minutes then loginform is displayed. This all works fine, except that
loginform does not seem to be a child of form_x. Hence I am able to interact
with form_x. I want the focus to be on loginform until it is closed. here is
my code.
public partial class bgform : Form
{
private void someFunction (......)
{
Form_x form_x = new Form_x();
form_x.ShowDialog();
................
//loginform is activated by idle time
LoginForm loginForm = new LoginForm();
loginForm.ShowDialog();
loginForm.TopMost = true;
loginForm.Parent = form_x;
.................
.................
}
}
//currentForm.Visible = false;
loginForm.ShowDialog();
loginForm.Parent = currentForm;
loginForm.TopMost = true;
//MessageBox.Show(currentForm.Name);
}