CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2001
    Location
    Kansas, USA
    Posts
    11

    Functions - Default Parameters

    Hi,

    Is there any way in Visual Basic to have a function with default values for parameters (just like in C++)?

    Thanks.

    Regards,
    Jagan.


  2. #2
    Join Date
    Jan 2000
    Location
    Pennsylvania, United States
    Posts
    106

    Re: Functions - Default Parameters

    You can set default values.


    private Function Testing(optional byval iTest as Integer =1) as string

    if itest =1 then
    testing="works"
    else
    testing = str(itest)
    endif

    end function




    should be something like that. Check a vb book for the correct arglist.
    -David


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured