Calling one sub from another

  • Thread starter Thread starter Steven K
  • Start date Start date
S

Steven K

Hello,

I have an image button that calls the sub "Image_Click". This in turn call
the sub "Submit_Click". I am getting the error:
Argument not specified for parameter 'E' of 'Public Sub Submit_Click(sender
As Object, E As System.EventArgs)

What and why do parameters need to be sent with this sub, when it works with
others?

Thanks in advance...

<asp:ImageButton runat="server"
ImageURL="go.jpg"
ImageAlign="Middle"
AlternateText="MyButton"
OnCommand="Image_Click"
CommandName="ASPNET"/></td>


Sub Image_Click (Src As Object, Args As CommandEventArgs)
Submit_Click
End Sub

Sub Submit_Click(sender As Object, E As EventArgs)
Response.Write("Hello World<br>")
End Sub
 
Any Method which takes a parameter must have that parameter passed to it. An
Event Handler has the correct parameters passed to it by the object which
raised the event. In your case, you're not passing any parameters to a
method that takes 2 of them.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Back
Top