|
-
Apr 8th, 2000, 07:53 PM
#1
Thread Starter
Junior Member
I have a public function in a class module but this function returns a value of a user defined type. This causes a error saying that it's not possible to have a user defined type as a parameter of a public method.
Why is it not possible to have a user defined type in a class module without having to declare the function as private? I want this function to be exposed. The function header is as follows:
Public Function GetRGB(RGBValue As Long) As RGBTRIPLE
"He who laughs at a question is not worth being asked"
RavenCrow

-
Apr 8th, 2000, 08:30 PM
#2
Addicted Member
Try setting the User Defined Type as a paramater to the function, like this:
Public Sub GetRGB(RGBValue As Long, MyType As RGBTRIPLE)
In VB UDTs arepassed by reference, meaning that you pass the the stucture as an argument that you want to be populated by your procedure. When the procedure returns the UDT will be populated.
Hope this is what you wanted.
-
Apr 8th, 2000, 08:35 PM
#3
Frenzied Member
There's some hiddeous technical reason why you can't pass out UDTs also, it's considdered bad practice to expose a UDT anyway, expose the red green and blue values as properties and expose a long representing the RGB Triple (Use the CopyMemory API inside your class to copy the RGB tripple into a long.)
-
Apr 8th, 2000, 08:56 PM
#4
Thread Starter
Junior Member
Thanks for the advice guys, it's very much appretiated
"He who laughs at a question is not worth being asked"
RavenCrow

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|