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!

Public user defined types defined in public object modules ... Help!

Status
Not open for further replies.

voydangel

Programmer
Dec 10, 2004
18
0
0
US
Public nTemp2 as Integer
Public market(3) As Markets

Type Markets
nItemSellRate(11) As Currency
nItemBuyRate(15) As Currency
isItemSellable(11) As Boolean
isItemBuyable(15) As Boolean
End Type

For nTemp2 = 0 To 3
market(nTemp2) = MakeMarket(nTemp2)
Next nTemp2


By the Way: MakeMarket(Index As Integer) is a function in a module file.

Getting the following 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."

What Gives? MSDN Help is not very helpful....Where am I going wrong?
Using VB6.
 
I think you have to declare the type Markets in a module, not in a form, as i imagine you did.
 
hmm, that would probably have worked, although, What I did to make it work was to revise my code as follows:

For nTemp2 = 0 To 3
MakeMarket(nTemp2)
Next nTemp2

it works in this case perfectly....i think the problem was that my function doesnt return a value, so VB was horking on the attempt to set the value of market. Thanks for the tip though.
 
voy,

Just an observation which may or may not help.

The Markets Type definition should precede;

Public market(3) As Markets

regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top