I have three forms Main, Sales and Login.
In Main form I have a timer, example after 5 minutes Login form will be fire up.
I can Open a Sales form the Main form whitout closing the Main form, so Login form will be fire up.
The problem is the Login form does not focus on top of the Sales form, so that the user must login to use the sales form.
Some code on Main form :
public void timer_Tick(object sender, EventArgs e)
{
timer.Stop();
LoginDialog loginForm = new LoginDialog();
loginForm.TopLevel = true;
loginForm.ShowDialog();
timer.Start()
}
private void pbSales_Click(object sender, EventArgs e)
{
Sales salesForm = new Sales();
salesForm .ShowDialog(this);
}
I think the issue is you are calling
ShowDialogfrom theMainFormand you have the Sales Form open also.The parent for the Dialog happens to be the
MainForm, so maybe you can try usingloginForm.ShowDialog(saleform1);salesform1 is the instance name of the Sales Form you opened from the Main form.