Results 1 to 3 of 3

Thread: optional

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2000
    Location
    Leeds
    Posts
    30
    Hi there, i have created a new sub, and have put its one parameter set to optional, then in the procedure i test to see if the sub was passed the parameter or not, but on testing it, the ismissing( ) always return false even if nothing is passed to the sub. the parameter type is integer and it no value is passed it seem to get automatically assigned the value 0. Any ideas on what is happening here?

    Thanks for any help, Piers
    The early bird gets the worm, but the second mouse gets the cheese.

  2. #2
    Fanatic Member Stevie's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    565
    IsMissing uses variants. This may be what your problem is as you are checking an integer.

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    There is no need for ismissing if youre using optional but you have to set the integer default value:
    Code:
    Sub blabla(Optional argument As Integer = -1)
        If argument = -1 Then
            'code
        Else
            'code
        End If
    End Sub
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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