Passing user defined types
-
Platform: VB6 I would like to pass a user defined type to a form. What I get is: 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. I understand that the compiler is whining that it doesn't know what the user defined type is composed of, but how do I go about describing the type definition to the compiler, before it reaches the form. Also, I cannot find any definition of what a 'public object module' is supposed to be in VB6. ------------------------------ A simplistic example would be: Project entry point: TestFrame.Main Form: frmBaseUse
Option Explicit Private udtmThing As UserDefinedType Public Sub Begin(ByRef udtThingy As UserDefinedType) ' Make the passed in structure local to the form. udtmThing = udtThingy Call Me.Show(vbModal) End Sub
Module: TestFrameOption Explicit Public Type UserDefinedType iX As Integer iY As Integer End Type Public Sub Main() Dim udtThg As UserDefinedType Dim fUseIt As New frmBaseUse udtThg.iX = 1 udtThg.iY = 2 Call fUseIt.Begin(udtThg) End Sub
------------------------------ Thanks for your help. denimined