Optional....

D

Doug Zody

How to make function argument as optional in Vb.Net?
I have a function signature as shown below. I am using .Net Framework 1.1.

Public Shared Function Foo(ByVal strCustNo As String, ByRef strActNo As
String) As String


End Function

How to make the above function parameter as optional. Exact syntax please.

Is it possible to make ByRef argument as optional.

Thanks,
Doug
 
S

Steve C. Orr [MVP, MCSD]

You use the keyword "Optional" and you must specify a default value that
will be used in case the parameter is not provided:

Public Shared Function Foo(ByVal strCustNo As String, Optional ByRef
strActNo As String = String.Empty) As String

End Function
 

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,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top