Friday, March 16, 2012

Optional....

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,
DougYou 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
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Doug Zody" <DouzZodyMail@.hotmail.com> wrote in message
news:uYAARIR9EHA.1392@.tk2msftngp13.phx.gbl...
> 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
>
>

0 comments:

Post a Comment