Optional....

  • Thread starter Thread starter Doug Zody
  • Start date Start date
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
 
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
 
Back
Top