Question:

VB6 optional parameter detection of object?

by  |  earlier

0 LIKES UnLike

I'm trying the following:

Sub MyCommTest(optional CommControl as MSComm)

End Sub

How do I detect if CommControl is passed without doing an On Err Resume Next?

 Tags:

   Report

1 ANSWERS


  1. There are two ways of doing this,

    1, You can supply a default value for the optional parameter, eg

    Sub MyCommTest(optional CommControl as MSComm = "foo")

    End Sub

    and do a check to see if the value is the same as the default.

    2, You can use the isMissing() function to determine if the parameter is not there. eg,

    Sub MyCommTest(optional CommControl as MSComm)

    if isMissing(MSComm) then

    end if

    End Sub

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.
Unanswered Questions