Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 884
  • Last Modified:

Form Initialize and Form Load

What is the difference between Form Initialize and Form Load? I am ofter confused on which functions to call in Form Initialize and which on Load.
0
rpkhare
Asked:
rpkhare
  • 2
  • 2
  • 2
  • +1
2 Solutions
 
Wayne Taylor (webtubbs)Commented:
There is no Form.Initialize() event in .Net 2005. For calling routines when the form first opens, use the Form.Load() event.

Wayne
0
 
Éric MoreauSenior .Net ConsultantCommented:
Initialize is very early in the call chain. You normally cannot access controls from it.
0
 
angus_young_acdcCommented:
Your form initialise would be one of the first things, so I tend to declare any simple stuff there which is required whilst the form is loading.  For the Form_Load I generally use that to set things such as whether a control is visible yet etc.
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
rpkhareAuthor Commented:
emoreau,

Previously I was filling my DataGridView on Form Load. Later I decided to fill in From Initialize followed by Application.DoEvents(). This has considerably increased the performance. Why?
0
 
Éric MoreauSenior .Net ConsultantCommented:
I can't say. I would have to try/trace your code. Maybe you can play with suspendlayout/resumelayout
0
 
rpkhareAuthor Commented:
Can you please explain: Suspend Layout and Resume Layout.
0
 
angus_young_acdcCommented:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.suspendlayout.aspx

The SuspendLayout and ResumeLayout are methods used in order to prevent conflict when events pertaining to placing and moving controls  and setting their attributes are thrown.

You would for instance perhaps  like to add controls onto a panel or a window programatically .. what you must do is suspend the control you are adding other controls to and after you are done adding ,you then can resume your layout by calling the ResumeLayout method.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now