[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 651
  • Last Modified:

parameters on page_unload

This should be a really easy one.  Some of the references I have seen say to write page unload as:

sub page_unload(sender as Object, e as EventArgs)

and others as:

sub page_unload()

am I correct in assuming that either one will work correctly?  I just want to make sure.  Thanks a lot,

--Adam

0
ARACK04
Asked:
ARACK04
1 Solution
 
shovavnikCommented:
You should use the first one.  I'm not sure the second will work.

Keep in mind that this is an event handler.  That is, when the page unloads, asp.net throws a Page_Unload event to which you can hook a handler.

When you hook to that handler, you need to match the delegate of that event.

The first method uses the EventArgs parameter to pass the event data and the sender object to tell you who threw the event.

The second method (without the parameters) is probably just used as a short form on forums because nobody want to write out the whole function definition (signature) in a simple forum.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now