How to bring dialogbox on top all open form

Viewed 10871

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);
        }
3 Answers
Related