Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

compile error - passing user-defined type to class function

Status
Not open for further replies.

Glade

Programmer
Jan 7, 2002
9
0
0
CA
I'm having a problem passing a user defined type to a function in one of my classes. I have declared a user-defined type in a module (a regular, "code" module) that looks like this:

Public Type Data_Comparison
Data_Level As Integer
Data_List() As Integer
Description As String
End Type

In a class module I have declared a function like this:

Public Function Search_RE_for_Duplicates(ByVal Comparison_Values As Data_Comparison) As Integer()

When I attempt to run the program, I get a compile error that says:

"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."

I'm confused, because this IS a public user defined type, and it IS defined in a public object module, as far as I can tell. Why is it giving me this error? The only thing I can think of is that I declare it in a regular module, and I'm guessing that when it says "object module" it may mean a class module. However, when I try to declare it in a class module, I get another error:

"Cannot define a Public user-defined type within a private object module."

Your help would be appreciated.

-Adrian
 
Is this a typo

Public Function Search_RE_for_Duplicates(ByVal Comparison_Values As Data_Comparison) As Integer[COLOR=red}()[/color] ?
If you choose to battle wits with the witless be prepared to lose.
[machinegun][ducky]
 
Sorry about that. Talk about typos! This is what I meant

Public Function Search_RE_for_Duplicates(ByVal Comparison_Values As Data_Comparison) As Integer()
If you choose to battle wits with the witless be prepared to lose.
[machinegun][ducky]
 
Foada, no that's not a typo, the function returns an array of integers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top