?
Solved

win form close login page c#

Posted on 2011-03-24
2
Medium Priority
?
518 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 19

Accepted Solution

by:
Rikin Shah earned 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

762 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