Click here to Skip to main content
16,011,585 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I’m creating a Windows Form Application in C# (VS2010) and what I’m trying to do is have the first form be displayed. Then before allowing any access to the form functions, popup a second form where the user must validate themself for access to the application. What I’m finding is the first form will not paint itself until after the Form_Load event is finished. But after that, I lose control until another event is triggered by the user. None of the other Form events seem to trigger after the Load. Does anyone know how I can get the second form to trigger after the Form_Load is completed?

Thanks!
Posted
Updated 8-Jun-10 4:08am
v2

Form_Shown is triggered after the load event (and after the form is shown), so you can use that.
 
Share this answer
 
v2
Comments
rildon 8-Jun-10 10:28am    
That worked great! Thank You!
A better solution would be to have the user validate themselves first.

* Show logon form
* If credentials successful then load main screen
* If not, terminate application

This is more in line with expected behaviour in windows applications
 
Share this answer
 
Comments
rildon 8-Jun-10 10:31am    
This is actually what I had first. I called the Validation form in the program.cs and only invoked the application if the user passed. I was requested to display the application's main page before popping up the Validation form so users would know what they are signing into. I appreciate your time and response. Thank You!
I believe there's a loaded event and an event fired when the form is first visible.
 
Share this answer
 
I thought that the Form.Activated event fired after Form.Load. It does fire every time the form gets the focus though so if you decided to use it you would need some sort of flag to indicate if the user was verified and bomb out if they already are.

It is more usual to verify prior to loading the main form and if you consider this then there are several articles on how to do so, here on Code Project.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900