Opening and closing forms, form shows multiple times in taskbar C#

  • Thread starter Thread starter tendaimare
  • Start date Start date
T

tendaimare

Guest
I have a c# winforms project which has 3 forms the Splash form , the Login form and the Menu form. the Startup from is the Spash of course. the user will press a button to move to the Login form and the after that proceed to the menu.

The problem is that even though the program is doing this but it is showing multiple time in the taskbar, I am no longer sure if i am closing the forms right or i am making a mistake

I have uploaded a sample project in the microsoft onedrive here

My program.cs

namespace TestProject
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormSplash());
}
}
}

My splash.cs code

namespace TestProject
{
public partial class FormSplash :System.Windows.Forms.Form
{
public FormSplash()
{
InitializeComponent();
}
private void BtnProceedToLogIn_Click(object sender, EventArgs e)
{
FormLogin myLogIn = new FormLogin();
myLogIn.ShowDialog();

this.Close();
}
}
}


My Login.cs

namespace TestProject
{
public partial class FormLogin : System.Windows.Forms.Form
{
public FormLogin()
{
InitializeComponent();
}
private void BtnProceedToMenu_Click(object sender, EventArgs e)
{
FormMenu myMenu = new FormMenu();
myMenu.ShowDialog();
this.Close();
}
}
}


And this is when the menu form is open and all the other forms are closed. My question is how come 3 pages are open in the Taskbar when only the menu is open. is there something i can do so that only one page shows instead of three like this

1357089.jpg



If you think it you can achieve it

Continue reading...
 
Back
Top