sub arguments

sirtopdog

New Member
What do the arguments:<BR><BR>(Sender As Object, E as EventArgs)<BR><BR>mean? Can anyone provide a simplr amswer?<BR><BR>Many thanks...> Sender As Object, E as EventArgs<BR><BR>or (in C#) ....<BR><BR> > Object Sender, EventArgs E<BR><BR>When an event occurs within an ASP.NET page that triggers a call to the server information regarding the calling object is sent and passed into the target function. <BR><BR>The object is basically the object that triggered the event.<BR><BR>The EventArgs is an object containing information about the object that triggered the event.<BR><BR>Together they enable you to interrogate the calling object.<BR><BR>An excellent example of this is if I have a DataGrid Control on my page such as:<BR><BR> <asp:DataGrid id="foo" runat="server" OnEditCommand="DataGrid_Edit" /><BR><BR>And I write my Sub or Function to recieve the event.<BR><BR>VB Version:<BR><BR> Public Sub DataGrid_Edit(S As Object, E As EventArgs)<BR> myLabel.Text = E.Item.ItemIndex<BR> End Sub<BR><BR>C# Version:<BR><BR> Public void DataGrid_Edit( Object S, EventArgs E )<BR> {<BR> myLabel.Text = E.Item.ItemIndex ;<BR> }<BR><BR>So, this example shows how we were able to get information about the DataGrid by interrogating the EventArgs.<BR><BR>HTH<BR><BR>Darren<BR>[ [email protected] ]
 
Top