Solved

win form close login page c#

Posted on 2011-03-24
2
515 Views
Last Modified: 2013-12-17
Hi,

I have a form called Login which is my first form.

So when a user clicks btnlogin I want the Login form to close. and go to second form
Not sit in the background that is the login form

How can i do this.

Please help

Thanks,

R8VI
0
Comment
Question by:R8VI
2 Comments
 
LVL 19

Accepted Solution

by:
Rikin Shah earned 500 total points
ID: 35205847
If you call second form with
Form2 frm2 = new Form2();
frm2.Show();

and close the loginform.Close();

This will close both.

Instead I would suggest you open frm2 as default and its load event will have login form with

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

if the login is success frm2 will show itself otherwise will show message and if login is closed frm2 will be closed as login form will return false.
0
 
LVL 13

Expert Comment

by:Naman Goel
ID: 35206018
I can say open login form as dialog with two button Login and Cancel

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

put DialogResult property for Login button as OK and set login button as OK button.

please refer to following article for dialog:

http://support.microsoft.com/kb/816145

and put your code in Login button click event to open your second form
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question