MyBase.Load

  • Thread starter Thread starter rn5a
  • Start date Start date
R

rn5a

Often I come across the following Page_Load sub declaration in ASPX
pages:

Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs) Handles
MyBase.Load
........
........
End Sub

What does MyBase.Load do here? What for it is used? Is there any
difference between the above Page_Load sub declaration &

Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)
 
Howdy,

Yes, there is a difference.

The First one is explicit declaration that attaches event handler to Load
event and will work even if the autorwireevents is set to false (default for
code behind files - Asp.net 1.1). the second will only work if
autorwireevents="true" (asp.net attaches handler for you when page is
compiled - default for dynamic compilation and code files in asp.net 2.0)

Hope this helps
 
Back
Top