Thread Form Problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dear all

I have a problem about thread. I create a thread name Login in MainForm Load function. And the login thread function is for user login verify. I want implement that if user not pass verify , he can't use mainform , just like unfucosing the mainform. In such case , if I 'm not use thread is very easy. But if I use thread , than a lost control mainform right. I don't know what can I do

thanks.
 
Hi bearbaba,

I'm not quite sure why you want to use a thread if you need to prevent the
user to access the form during login. Wouldn't a simple Dialog procedure
before running "Application.Run" in your Main() be better?

If the goal is to show the form, but in disabled state you can change your
constructor to

public MyClass(bool showform)
{
}

and

public static void Main()
{
LoginForm lf = new LoginForm();
if(lf.ShowDialog() == DialogResult.OK)
{
Application.Run(new MainForm(true));
}
else
{
Application.Run(new MainForm(false));
}
}

Happy coding!
Morten
 
Back
Top