By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,587 Members | 1,076 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,587 IT Pros & Developers. It's quick & easy.

Subroutines multiple arguments

P: n/a
jim
Hi,

This might be a dumb question but i'm trying to pass a couple of
arguments to a subroutine and keep getting an error message

This:

Sub showNumbers(a As Integer)
MsgBox (a & ", " & a)

End Sub
Private Sub Command0_Click()
showNumbers (1)

End Sub

Works Fine!


But This:

Sub showNumbers(a As Integer, b As Integer)
MsgBox (a & ", " & b)

End Sub

Private Sub Command0_Click()
showNumbers (1, 2)

End Sub

gives a syntax error..

Any help much appreciated..

thanks

jim

Nov 21 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Try calling like this

showNumbers 1,2
"jim" <ji*@j.comwrote in message
news:cr******************************@posted.metro net...
Hi,

This might be a dumb question but i'm trying to pass a couple of
arguments to a subroutine and keep getting an error message

This:

Sub showNumbers(a As Integer)
MsgBox (a & ", " & a)

End Sub
Private Sub Command0_Click()
showNumbers (1)

End Sub

Works Fine!


But This:

Sub showNumbers(a As Integer, b As Integer)
MsgBox (a & ", " & b)

End Sub

Private Sub Command0_Click()
showNumbers (1, 2)

End Sub

gives a syntax error..

Any help much appreciated..

thanks

jim

Nov 21 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.