Calling another subroutine

S

sck10

Hello,

How do you reference a sub that uses CommandEventArgs from another sub? For
example, I would like to call the sub "EmployeeOld_Click" from "Call_MySub".

Sub Call_MySub()
Call EmployeeOld_Click(Something here, Something here)
End Sub


Sub EmployeeOld_Click(ByVal Src As Object, ByVal Args As CommandEventArgs)
Me.pnlEmployeeNew.Visible = True
End Sub
 
A

Andrea Zani

sck10 said:
How do you reference a sub that uses CommandEventArgs from another
sub? For example, I would like to call the sub "EmployeeOld_Click"
from "Call_MySub".

Sub Call_MySub()
Call EmployeeOld_Click(Something here, Something here)
End Sub


Sub EmployeeOld_Click(ByVal Src As Object, ByVal Args As
CommandEventArgs) Me.pnlEmployeeNew.Visible = True
End Sub

Sub Call_MySub()
EmployeeOld_Click(nothing,nothing)
End Sub
 
B

billrob458

Since it appears you are not using the CommandEventArgs parameter in
your EmployeeOld_Click method, you can call it passing empty
parameters.

Sub Call_MySub()
EmployeeOld_Click Nothing, EventArgs.Empty
End Sub

HTH,

bill
 
G

Guest

it would be cleaner to move the code within EmployeeOld_Click to a common
function and call the common funtion from both EmployeeOld_Click and
Call_MySub... my 0.02$
 

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,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top