CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2000
    Essex, Uk

    vb6 ismissing function (resolved)

    Hi All,

    I'm just starting .NET. In vb6 there was a function is missing i.e.

    public function deleteme(optional fred as variant)
    if ismissing(fred) ............

    What should the syntax be in .NET2003 since it doesn't support isMissing.

    Last edited by Bill Crawley; October 1st, 2004 at 09:14 AM. Reason: resolved
    If you find my answers helpful, dont forget to rate me

  2. #2
    Join Date
    Jun 2001
    MO, USA

    Re: vb6 ismissing function

    You should no longer use optional parameters. If you need to use different parameters at different times, make overloads of the function. ie:

    Public Function SomeFunction(param1 as string) as string
    Public Function SomeFunction(Param1 as string, Param2 as integer) as string
    Public Function SomeFunction(Param1 as string, Param2 as integer, Param3 as long) as String


  3. #3
    Join Date
    Mar 2002
    St. Petersburg, Florida, USA

    Re: vb6 ismissing function

    DSJ is correct!

    While there are "some" reasons for using optional arguments [vastly depreciated] there is no reliable way to determine if a parameter has been specified

    A procedure cannot detect at run time whether a given argument has been omitted or the calling code has explicitly supplied the default value. If you need to make this distinction, you can set an unlikely value as the default.
    Overloaded methods (which were not previously available) are a much better way to go. [espcially if other languages may eventually want to access the routine]
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.