sub arguments

Results 1 to 2 of 2

Thread: sub arguments

  1. #1
    jhollett Guest

    Default sub arguments

    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...

  2. #2
    Join Date
    Dec 1969

    Default RE: sub arguments

    &#062; Sender As Object, E as EventArgs<BR><BR>or (in C#) ....<BR><BR> &#062; 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> &#060;asp:DataGrid id="foo" runat="server" OnEditCommand="DataGrid_Edit" /&#062;<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>[ ]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts