Partager via


The Form Load event

Shawn posted a mini-rant / tip about not subscring to your own events.  I've got to post a small rebuttal.  In general, not subscribing to your own events is a good coding practice, if not a huge perf win as Chris Sells points out in the post's comments.  On the other hand, subscribing to your own Load event has a good purpose, it is the handle first created event.  There are a lot of times you want to do stuff after your handle is first created.  An example is here.

While everyone reading this blog certainly realizes the differences between code in the Form's constructor and the Load event, the average VB user, or Mort as we call him internally, doesn't.  Mort thinks of the Load event as if it is the Form's constructor and loves to be able to double click to add constructor-esque code.

In summary, the Load event is about convenience and about handle creation.

Comments

  • Anonymous
    April 07, 2003
    morts? MORTS? : Julia Lerman Blog
  • Anonymous
    April 07, 2003
    Aw, it's not so bad being a Mort... : Keith Pleas Blog
  • Anonymous
    April 07, 2003
    ISerializable
  • Anonymous
    July 07, 2003
    NO thoughts since April 7th? ;)
  • Anonymous
    January 06, 2004
    The comment has been removed
  • Anonymous
    April 06, 2004
    plase give me coding in form load event in VB.NET