Passing User Defined Type as a parameter in method gives a VB5 error 
Author Message
 Passing User Defined Type as a parameter in method gives a VB5 error

Hi,

I have defined a method having user defined type variable as one of it's
parameter in a class. This method is declared as a public. VB5 flags this
methods as an error with a msg

"  User-defined types and fixed-length strings not allowed as the type of a
Public member of an object module; Private object modules not allowed as the
type of a public member of a public object modules".

Example:

' Defined this type in a standard module
Type TSheath
    SHID as integer
    CBLID as integer
End Type

' Class FSheath...
' Defined inside class module
Public sub AddSheath (Sh as TSheath)
...
End Sub

VB5 does not complain if I define this method as private.

Anybody know how to circumvent this problem.

Thanks for your help
Hari Somaskanthan



Sun, 26 Nov 2000 03:00:00 GMT  
 Passing User Defined Type as a parameter in method gives a VB5 error

Use a class instead of a user defined type for a Public Method() since user
defined types do not belong to a public interface.



Mon, 27 Nov 2000 03:00:00 GMT  
 Passing User Defined Type as a parameter in method gives a VB5 error

You can't pass UDTs to Public properties or methods, but as long as you're
only accessing the class from within the same project that it's defined in,
you can declare the class's methods as Friend, which will allow the passing
of UDTs.

Jonas
TRION Technologies

Quote:

>Hi,

>I have defined a method having user defined type variable as one of it's
>parameter in a class. This method is declared as a public. VB5 flags this
>methods as an error with a msg

>"  User-defined types and fixed-length strings not allowed as the type of a
>Public member of an object module; Private object modules not allowed as
the
>type of a public member of a public object modules".

>Example:

>' Defined this type in a standard module
>Type TSheath
>    SHID as integer
>    CBLID as integer
>End Type

>' Class FSheath...
>' Defined inside class module
>Public sub AddSheath (Sh as TSheath)
>...
>End Sub

>VB5 does not complain if I define this method as private.

>Anybody know how to circumvent this problem.

>Thanks for your help
>Hari Somaskanthan



Mon, 27 Nov 2000 03:00:00 GMT  
 Passing User Defined Type as a parameter in method gives a VB5 error

On Wed, 10 Jun 1998 18:55:41 +0200, "Hari Somaskanthan"

?Hi,
?
?I have defined a method having user defined type variable as one of it's
?parameter in a class. This method is declared as a public. VB5 flags this
?methods as an error with a msg
?
?"  User-defined types and fixed-length strings not allowed as the type of a
?Public member of an object module; Private object modules not allowed as the
?type of a public member of a public object modules".

?VB5 does not complain if I define this method as private.
?
?Anybody know how to circumvent this problem.

Not in the current version of Visual Basic. The recommendation is to
convert your UDT a class.

Paul
~~~~



Mon, 27 Nov 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Passing User Defined Type as a parameter in method gives a VB5 error

2. Passing Array or a user defined data type as a parameter to a storedprocedure in Oracle

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

4. Passing Array or a user defined data type as a parameter to a storedprocedure in Oracle

5. How to: Pass User Defined Type as parameter

6. Bug VB5 Dll: Passing and Returning User-Defined Types

7. VB5 passing arguements, user defined types and arrays

8. Bug VB5 Dll: Passing and Returning User-Defined Types

9. Passing User-Defined Type in VB5?

10. Bug VB5 Dll: Passing and Returning User-Defined Types

11. How do I pass a VB5 user defined type/structure to a C DLL

12. Error using user-defined type in parameter of public procedure in a class module

 

 
Powered by phpBB® Forum Software