Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

C# Problem

  • 07-09-2008 08:27PM
    #1
    Registered Users, Registered Users 2 Posts: 1,991 ✭✭✭


    I have the below code in a separate class, the thing is when it runs the frmMain show up but the frmLogin wont hide!?! Any ideas?
    frmLogin login = new frmLogin();
    frmMain main = new frmMain();
    
    login.Hide();
    main.Show();
    


Comments

  • Registered Users, Registered Users 2 Posts: 303 ✭✭brian_rbk


    Try...
    frmLogin login = new frmLogin();
    frmMain main = new frmMain();
    
    login.Visible = false;
    main.Visible = true;
    


  • Registered Users, Registered Users 2 Posts: 1,991 ✭✭✭Ziycon


    Nope, didn't work! Any other ideas, it seems very strange for it not to work!?


  • Registered Users, Registered Users 2 Posts: 1,991 ✭✭✭Ziycon


    Got it working, i was creating and closing a new instance of the frmLogin form. I've added the function to return a boolean value to the login form so if the login details are all correct it'll return a true value so on the login form i have the below if statement and it seems to be working ok, thanks for that Plater.
    validate = dbconn.login(txtUsername.Text, txtPassword.Text);
    if (validate)
       this.Hide();
    


Advertisement