Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Project with login form at the beginning in Visual C#

    I'm creating a project with a Login Form at the beggining, then goes straight to the Main Form after login. But the problem I'm facing is that my Main Form is showing with no controls on it, but when it's not running it has controls.
    The Login Form runs perfectly and shows it's controls but after I click the login button to take me to the Main Form the Form appears with no controls at all. What might be the problem?

  • #2
    New Coder
    Join Date
    Jul 2011
    Location
    Chennai, India
    Posts
    23
    Thanks
    0
    Thanked 5 Times in 5 Posts
    Hi Peniel,

    check the visible property of the controls.
    Use F11, while debugging. It'll show the detailed execution flow

  • #3
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    still can't find fault

    Hey Nanda
    All my controls are set to true on the visible property. This is what I did, I put this code in the program.cs file of my project.

    static void Main()
    {
    Form fclsLoginDialog = new Form();
    Form fclsMain = new Form();

    if (fclsLoginDialog.ShowDialog() == DialogResult.OK)
    {
    Application.Run(new fclsMain());
    }
    else
    {
    Application.Exit();
    }
    }


    then on my Login button click event this is how my code looks like

    private void btnLogin_Click(object sender, EventArgs e)
    {
    String strUsername = "peniel";
    String strPassword = "password";

    if (this.txtUsername.Text == strUsername && this.txtPassword.Text == strPassword)
    {
    Form fclsMain = new Form();

    fclsMain.Show();
    this.Dispose();

    }
    else
    MessageBox.Show("Please enter your correct Username and Password");
    return;

    }



    But when i tried using the f11 key it seems like the code in the programs.cs file is not being executed when it comes to opening the fclsMain.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •