I am using Visual Basic V6.0 SP5. (Switching to VB.Net
is not a practical answer.)
I need to pass an array of user-defined types to
a method in a class object. I get nothing but
"Compile error" messages.
Here are a few of the things I have tried and the message
generated.
**************************
**********
**********
**********
cls1.cls
Public Type my_type
Dim foo As Integer
End Type
Compile error:
Cannot define a public user-defined type within a
private object module.
---
What makes this object module private, and how could I
set it to be public.
**************************
**********
**********
**********
cls1.cls
Private Type my_type
Dim foo As Integer
End Type
Public Function clsfunc(foo() As my_type) As Integer
End Function
Compile error:
Private Enum and user defined types cannot be
used as parameters or return types for public
procedures, public data members, or fields
of public user defined types.
---
Fair enough.
**************************
**********
**********
**********
mod1.bas
Public Type my_type
Dim foo As Integer
End Type
Public my_array(100) As my_type
Sub modsub1()
Call clsfunc(my_array)
End Sub
--
cls1.cls
Public Function clsfunc(foo() As my_type) as Integer
End Function
Compile error:
Only public user defined types defined in public
object modules can be used as parameters or return
types for public procedures of class modules or as
fields of public user defined types
---
My intention was that mod1.bas be a public object module.
I have not figured out what constitutes a public object
module into which I can put my public user-defined type.
Can somebody please help? How can I pass a user-defined
type to a sub or function in a class object?
**************************
**********
**********
**********
If I get a C/C++ error message that I do not understand,
it always comes with an error number. I search that
number on an MSDN support disk and I usually find a
KB article or two that tells me more than I wanted to
know.
How could I search the MSDN disk for an error message
as the ones I received?