|
-
December 12th, 2003, 03:57 AM
#1
User-Defined data-types/private, public access to private object model
Compiler Error:
Only user-define types defined in public object models can be coerced to or from a variant or passed to late-bound functions.
The following error I get with the following circumstances...
1. I have a Form called: "frmTest"
2. I have a Class called: "clsTest"
3. I have created a <type>:
Private Type DAFormat
ctlName As String
bChanged As Boolean
End Type
4. I create an instance of the class in the form:
Dim clsRun As New clsTest
clsRun.ProcessData
5. The class method: "ProcessData"
Dim clCollection As new Collection
Dim dType As DAFormat
dType.ctlName = "ctlText"
dType.bChanged = False
*** clCollection.Add dType, dType.ctlName ***
Why do I get this compile error at this line where adding a type definition to a collection, and according to what they say in MSDN you can add objects or any data type to the collection.
My class is private, I have no Idea, can't remember as to how to change it to public, I thinkI have to create an ActiveX Control project ... Currently my project is Standard EXE. Why does biding complain since I have tried creating and adding a module called: "mdlMain", and adding the type/collection variables/types as public to this mdlMain, and trying to access that within the class: "clsTest", but nothing I have tried works.
Any suggestions/help on this topic?
Thank you in advance ...
xIRC
-
December 12th, 2003, 06:05 AM
#2
Only user-define types defined in public object models
That is:
Define your user-define types
in public object models =a class module with instancing higher than private (maybe even more than "public not creatable")
Thus:
create a new dll project.
in a class with instancing = multiuse define your Udt as public.
Compile.
Where you need that Udt, set early binding to that dll (=set a reference to it via Project->references)
In these projects, define a variable as yourDllMainClass.TheUdt
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
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
|