Optional....

Discussion in 'ASP .Net' started by Doug Zody, Jan 7, 2005.

  1. Doug Zody

    Doug Zody Guest

    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
     
    Doug Zody, Jan 7, 2005
    #1
    1. Advertising

  2. 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

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://Steve.Orr.net



    "Doug Zody" <> wrote in message
    news:...
    > 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
    >
    >
    >
    >
     
    Steve C. Orr [MVP, MCSD], Jan 8, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dan Davenport via .NET 247

    Bind optional one-to-one relationship to textbox

    Dan Davenport via .NET 247, Aug 4, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    645
    Dan Davenport via .NET 247
    Aug 4, 2004
  2. Charles Shannon Hendrix

    REGEX: capturing on optional groups which fail

    Charles Shannon Hendrix, Jun 14, 2004, in forum: Perl
    Replies:
    0
    Views:
    566
    Charles Shannon Hendrix
    Jun 14, 2004
  3. Kerri
    Replies:
    0
    Views:
    357
    Kerri
    Aug 12, 2003
  4. Do
    Replies:
    1
    Views:
    67,471
    Kevin Spencer
    Oct 16, 2003
  5. ruca

    Optional and have default value

    ruca, Apr 12, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    432
    Marina
    Apr 12, 2004
Loading...

Share This Page