I have problem with show or hide form in Window Form Application.
I start first running loginform at program.cs ( Application.Run(new loginform());), when login success, then show another form ( Main Interface ) and I want to close or hide loginform when second form is shown, but it is not working.
I don know how to do it. Is it a Thread related problem or not?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace Myapp
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Loginfrm());
}
}
}
You could add a property to your
Loginfrmclass indicating if login was sucessfull or not.Then, after closing the your
Loginfrm, you could start another message loop.Example: