Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7700101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:37:47+00:00 2026-05-31T22:37:47+00:00

I have a log in form on my app. Once a correct user name

  • 0

I have a log in form on my app. Once a correct user name and pass word are provided I want the log in form to close and my main form to open. I had trouble doing this so I used a quick fix and coded it so that a succesful login meant the log in form’s Visible property got set to false (making it look like it had closed to the user). But I’m not happy with this solution since it means the log in form is always open.

The code I have on my frmLogIn is

Form fM = new frmMain();
this.Visible = false;
fM.Show();

How do I change this so that frmLogIn actually closes as frmMain opens?

PS. I also tried this code from another thread on these forums, but this doesnt work either.

Form fM = new frmMain();
fM.Location = this.Location;
fM.StartPosition = FormStartPosition.Manual;
fM.FormClosing += delegate { this.Show(); };
fM.Show();
this.Hide(); 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T22:37:48+00:00Added an answer on May 31, 2026 at 10:37 pm

    So say you are in the main applications forms Load event. Here you might launch your login screen

    LoginForm logForm = new LoginForm();
    logForm.ShowDialog();
    

    Then you might get whether the login passed from the relevant logForm‘s accessor, so in the logForm‘s Closing event

    this.passedLogin = true;
    this.Close();
    

    then back in the main forms Load event after the ShowDialog() above, you could check if the login passed, if it did not close the application or force a reattempt

    if (!logForm.passedLogin)
        this.Close();
    

    I hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WPF form that uses ClientLogin to log a user into their
I have a directory full of log files in the form ${name}.log.${year}{month}${day} such that
I have a log out button on my main menu and I want it
I have a Windows form App which write to log files using log4net. The
I have an express app that I want to use the connect-form module on
We've faced strange problem. We have log on service, that authenticates user, adds auth
I have a log function on my admin panel that checks user input for
I am quite new to windows form app development. I have an app installed
I have a Spring Security (form based authentication) web app running CXF JAX-RS webservices
I have a Windows Form app that creates a window and monitors for entries

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.