Object Sender and EventArgs

10,585

Solution 1

TextChange is (probably) the name of the relevant event, though the event isn't shown in your code snippet so I can't be sure.

TextBox1_TextChange is the name of a method that is probably set up to handle an event.

Object Sender is a parameter called Sender that contains a reference to the control/object that raised the event.

EventArgs e is a parameter called e that contains the event data, see the EventArgs MSDN page for more information.

See this page, Passing Parameters, for more information about how parameters work.

And this page, Events Tutorial, would probably be helpful as well.

Solution 2

Object Sender: which object is invoked the current event.in your case TextBox1 is sender. EventArgs e :e is the object for EventArgs, when TextChange is invoked object e contain arguments.

Share:
10,585
mahesh
Author by

mahesh

am just practising with c#,sql,crystal reports

Updated on June 04, 2022

Comments

  • mahesh
    mahesh almost 2 years

    Consider this function signature:

    Private Void TextBox1_TextChange(Object Sender, EventArgs e)
    

    As far as my knowledge goes I understand it as below.

    1. Private is a modifier

    2. Void is the return type

    3. TextBox1_TextChange is an event name.

    Maybe I am wrong in the above case as I just started practicing in C#, Visual Studio 2005.

    What is the definition/meaning of (Object Sender, EventArgs e) and how does it work?

  • mahesh
    mahesh over 13 years
    Sir, So the above i mean "Private Void TextBox1_TextChange (Object Sender, EventArgs e)" is a method or an Event?
  • Hans Olsson
    Hans Olsson over 13 years
    @mahesh: It's a method that's handling an event, so it can be called an Event Handler. An event will look something like public event ChangedEventHandler Changed; and then the Event Handler is hooked up to the Event using the += syntax as described in the tutorial linked to in my answer.
  • mahesh
    mahesh over 13 years
    Sir, Here i am accepted ur valuable and important answer for me. Thx