MyBase.Load

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)
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top