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 (6)

  1. Anonymous says:

    morts? MORTS? : Julia Lerman Blog

  2. Anonymous says:

    Aw, it’s not so bad being a Mort… : Keith Pleas Blog

  3. Adam Kinney says:

    NO thoughts since April 7th? 😉

  4. Kang Jin Soo says:

    Happy New Year! Mike.

    I am a beginer in programming field.

    I have a problem with VB.Net programming.

    I want to make a transparent user control,

    something like line control or polygon control.

    But it is very difficult to make transparent user control by VB.Net.

    If you have some document, example or sample code in VB.Net, then send me that. I will wait your reply. I will thank for your helpness.

    Below is my e-mail address.

    kangjinsoo@empal.com

    Thanks!

  5. plase give me coding in form load event in VB.NET