Click here to Skip to main content
15,901,205 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
how can i call the form_load event of the form explicitly ....
Posted
Comments
Sergey Alexandrovich Kryukov 8-Jun-12 11:45am    
Why it seems to be needed?
--SA

You can use the Refresh [^]method.

Else, a dirty trick would be to put all your initialization code into a method and not the constructor or the Form.Load event and just call that method. This can also include the designer-generated InitializeComponent() method which sets up all controls on the form. You should remove all controls on the form as your first action in that method, though.
 
Share this answer
 
Comments
VJ Reddy 8-Jun-12 9:27am    
Good suggestion. 5!
Manas Bhardwaj 8-Jun-12 9:36am    
thx!
Maciej Los 8-Jun-12 10:31am    
Yes! +5!
Manas Bhardwaj 8-Jun-12 10:35am    
Thanks!
Manas Bhardwaj 8-Jun-12 10:36am    
btw, what are doing on CP? you shud be in queue to enter stadium. Good luck for the match :)
Any method which is has a signature
C#
private void Form1_Load(object sender, System.EventArgs e)
can be assigned to the Load event of the Form as explained here http://msdn.microsoft.com/en-us/library/system.windows.forms.form.load.aspx[^]

If the method has public visibility or access then it can be called from the instance of the Form by passing the instance of the form as shown below

C#
Form1.Form1_Load(Form1, EventArgs.Empty);
 
Share this answer
 
v2
Comments
Manas Bhardwaj 8-Jun-12 9:36am    
nice +5 :)
VJ Reddy 8-Jun-12 9:51am    
Thank you, Manas :)
Maciej Los 8-Jun-12 10:32am    
Interesting ;) +5!
Sergey Alexandrovich Kryukov 8-Jun-12 11:52am    
Thank perhaps you'll find my comment even more interesting...
--SA
VJ Reddy 9-Jun-12 0:42am    
Thank you, losmac :)

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