Results 1 to 2 of 2

Thread: Calling Methods With Optional Parameters

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Posts
    1

    Post

    I have written a COM object in VB. I have created some methods with optional parameters. Now I am Using ASP/VB Script to call these methods.

    I am having a problem syntactically calling these methods if I do no want to pass all the parms. Using ":=" does not work and using multiple commas seems to almost work but I seem to be using them wrong.

    Any ideas??

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Using commas should work just fine. Here is an example:

    Code:
    Public Function MyFunction(MyParam1 As Integer, Optional MyParam2 As Integer = -1, Optional MyParam3 As Integer = -1)
    
    End Function
    Then calling this function like this:

    MyFunction 2, , 5

    Assuming that I don't pass the second parameter.



    ------------------

    Serge

    Programmer Analyst
    [email protected]
    [email protected]
    ICQ#: 51055819


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