Results 1 to 3 of 3

Thread: Enumerate Parameters

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2002
    Location
    North Carolina, US
    Posts
    81

    Enumerate Parameters

    Is is possible to enumerate parameters in a class module? I am building a COM DLL that other programmers will use and I want to make sure the variables are passed in the correct format. For instance, in the temperature example a parameter might be ConvertTo, and I want to be sure the user inputs "C" instead of Celsius. Is this possible?

  2. #2
    Frenzied Member PilgrimPete's Avatar
    Join Date
    Feb 2002
    Posts
    1,313
    Yes, it is possible to enumerate in a class module. However, there are some pretty stiff constraints. For a start, you can only use Longs (i.e. you can't use strings as you require in your example), and you need to set them to public if you want to pass them as arguments to procedures:

    VB Code:
    1. Public Enum TempScale
    2.    lngCelsius = 0
    3.    lngFahrenheit = 1
    4. End Enum
    5.  
    6. Public Function DoConversion(byVal sngValue as Single, byVal ConvertTo as TempScale) as Single
    7. 'blah
    8. End Function

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2002
    Location
    North Carolina, US
    Posts
    81
    That worked great. Thanks.

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