Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between OnLoad method and Load event?

What is the difference between OnLoad method and Load event? I am developing WinForm controls. Should I register to Load event or override the OnLoad method? What are the advantages and the disadvantages of each one?

like image 796
mokaymakci Avatar asked Jul 08 '09 07:07

mokaymakci


1 Answers

OnLoad method is the one that raises Load event. It's a standard pattern in framework classes, and a generally recommended one - for any event Foo, you have a virtual protected method OnFoo which raises that event; and no other method of the class raises the event directly, but always calls OnFoo.

If you need to handle the event on this, it's usually both easier and faster to override OnFoo.

like image 179
Pavel Minaev Avatar answered Sep 19 '22 11:09

Pavel Minaev