Help with passing user defined types as variables in functions - VB4 32bit 
Author Message
 Help with passing user defined types as variables in functions - VB4 32bit

I am defining about 20 different user types for database file layouts
and I am trying to pass each type through a variable in a function
but, I can't set a variable to a user defined type.  I get a type
mismatch if I use a variant.  I looked at the AS ANY declaration but,
this only works with DLL Declares.  Is there any way to pass different
user defined types through the same variable in a function or
subroutine?

Help will be greatly appreciated.

Thank You.



Tue, 27 Jul 1999 03:00:00 GMT  
 Help with passing user defined types as variables in functions - VB4 32bit

Quote:

>I am defining about 20 different user types for database file layouts
>and I am trying to pass each type through a variable in a function
>but, I can't set a variable to a user defined type.  I get a type
>mismatch if I use a variant.  I looked at the AS ANY declaration but,
>this only works with DLL Declares.  Is there any way to pass different
>user defined types through the same variable in a function or
>subroutine?

I don't think you can do it.

Have you considered using a collection instead? Maybe it could work.
You can use constants instead of numbers in the collection index for
readability.

Good luck!

Fulvio



Fri, 30 Jul 1999 03:00:00 GMT  
 Help with passing user defined types as variables in functions - VB4 32bit

Quote:
>I am defining about 20 different user types for database file layouts
>and I am trying to pass each type through a variable in a function
>but, I can't set a variable to a user defined type.  I get a type
>mismatch if I use a variant.  I looked at the AS ANY declaration but,
>this only works with DLL Declares.  Is there any way to pass different
>user defined types through the same variable in a function or
>subroutine?

No.  The variable has to be declared As <Name of Type>, ie ...

  Type DataRecordType
    ....
    ....
    ....
  End Type

  Sub SomeRoutine(MyType as DataRecordType)

----------------
Randy Birch, MVP
Visual Basic


Moderator, Fidonet Visual Basic Programmer's Conference

Visit VBnet at http://home.sprynet.com/sprynet/rasanen/



Sat, 31 Jul 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Help: Question about passing user-defined type to a function

2. Passing a user defined type to a function.

3. Passing User-defined types to public functions?

4. Passing user defined types to functions/procedures

5. Passing User-defined type to a public function?

6. Passing Public user-defined types via Public Functions

7. Problems defining a user defined type variable for use on more than one form

8. *Help -- Cannot pass user-defined types as parameters

9. User Control and User Defined Type Passing

10. Need help passing user defined types to ActiveXLL

11. Help passing user defined types

12. Passing Args of User Defined Types - HELP

 

 
Powered by phpBB® Forum Software