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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top