What are those parameters for?

  • Thread starter Thread starter learn
  • Start date Start date
L

learn

Guest
Hi,

Can you give me a very very simple example that shows what are the parameters (Object, EventArgs) for and what is Handles Button1.Click?

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
 
Sender is the object that was clicked. Since one sub can handle
the events of many control objects, you have to have some way
to know what control object was clicked. If you are only handling
the event from one control object, you can pretty much ignore it.
e as EventArgs is an object holding arguments that could be
passed from the event. Once again, if there aren't any
arguments, you can just ignore it.
 
Back
Top