Jump to content
  • Advertisement
Sign in to follow this  
Z3R0Bit

Simple question about the Form.Load event

This topic is 3702 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi For a code to be run at the startup of a Windows Application you could use the Form.Load event, right? But wouldn't it be easier to just right the code in the constructor? Is there a major difference between these two? Thanks in advance By the way, I don't think it makes much of a difference but I'm using C#.

Share this post


Link to post
Share on other sites
Advertisement
You should run code in response to the Form.Load event if you need that code to be run when the form is first shown. Code in the constructor is run when the form is created, not when it's shown. If your form is immediately shown after it's created there won't be much difference between the two, but this won't be the case for all forms. For example, consider the case where you create dialog, load it with some data through properties, and then display it.

[Edited by - MJP on June 27, 2008 6:43:53 PM]

Share this post


Link to post
Share on other sites
I see

Sorry for the easy question. It's been bothering me for some time now. I'd get stuck choosing between the two every time. But now I get the difference.

thanks

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!