Calling one sub from another

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
 
K

Kevin Spencer

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,169
Latest member
ArturoOlne
Top