|
-
Aug 7th, 2001, 01:32 AM
#1
Class instancing help
Can someome explain this error
Compile error:
Private object modules cannot be used in public object modules as parameters or return types for public procedures, as public data members, or as fields of public user defined types.
I have asked before and no reply, so i thought a new week maybe some new thoughts.
On MSDN it is states the obvious and does not help me.
Thanks
-
Aug 7th, 2001, 01:48 AM
#2
Did you declare something as Private? I assume you must declare everything Publically.
-
Aug 7th, 2001, 02:00 AM
#3
I have a project that builds a collection from various class's within that project. It builds it fine inside that project but i want this exposed in the front VB and i get this error. I had the instance type as private and it works within that project. When i change it to any of the other types i get an error. I have tried all combinatuons, changed all return types to public, even friend and am still getting this error.
The only way i know this will work is to put this project up into the front end, but that defeats the purpose.
Thanks for any assistance
-
Aug 7th, 2001, 02:04 AM
#4
Fanatic Member
Would it solve your problem if you were to create an interface dll for your classes (or back end?).
Let me know if I can help with this, zubair
-
Aug 7th, 2001, 02:07 AM
#5
Fanatic Member
Questions...
Ok. You have two projects? One with all the collection and class framework, and another for the front end? In a project group yeah?
Digital-X-Treme
Contact me on MSN Messenger: [email protected]
[VBCODE]Debug.Print Round(((1097) - ((55 ^ 5 + 311 ^ 3 - 11 ^ 3) _
/ (68 ^ 5))) ^ (1 / 7), 13)[/VBCODE]
-
Aug 7th, 2001, 02:25 AM
#6
here is some example code that i would like in the front end, this works fine in the project it is in, this is after all the processing is done.
when the class instances are private, no problem, but no good as i will not be able to see them in another project.
change the instance to public and i get the error
private col as collection
dim aclass as class1
dim bclass as class2
for each aclass in col
for each b in aclass.link ' where link is a collection of bclass
'do something
next
next
-
Aug 7th, 2001, 02:37 AM
#7
Fanatic Member
Instancing...
I would advise looking into the instancing properties of your class modules.
Here is an excerpt from MSDN.
The Instancing property has these settings:
1(Default) Private.
Other applications aren’t allowed access to type library information about the class, and cannot create instances of it. Private objects are only for use within your component.
The Instancing property default varies depending on the project type. Private is the default only for class modules in Standard Exe projects.
When you insert a new class module into an ActiveX Exe project or an ActiveX DLL project, the default value of the Instancing property is MultiUse. When you insert a new class module into an ActiveX Control project, the default value of the Instancing property is PublicNotCreatable.
2 PublicNotCreatable.
Other applications can use objects of this class only if your component creates the objects first. Other applications cannot use the CreateObject function or the New operator to create objects from the class.
3 SingleUse.
Allows other applications to create objects from the class, but every object of this class that a client creates starts a new instance of your component. Not allowed in ActiveX DLL projects.
4 GlobalSingleUse.
Similar to SingleUse, except that properties and methods of the class can be invoked as if they were simply global functions. Not allowed in ActiveX DLL projects.
5 MultiUse.
Allows other applications to create objects from the class. One instance of your component can provide any number of objects created in this fashion.
6 GlobalMultiUse. Similar to MultiUse, with one addition: properties and methods of the class can be invoked as if they were simply global functions. It’s not necessary to explicitly create an instance of the class first, because one will automatically be created.
Also, if you answer these Q's we might be able to help more... You have two projects? One with all the collection and class framework, and another for the front end? In a project group yeah?
Laterz
Digital-X-Treme
Contact me on MSN Messenger: [email protected]
[VBCODE]Debug.Print Round(((1097) - ((55 ^ 5 + 311 ^ 3 - 11 ^ 3) _
/ (68 ^ 5))) ^ (1 / 7), 13)[/VBCODE]
-
Aug 7th, 2001, 02:43 AM
#8
thanks for the definition and belive me i have been through them over and over again.
yes i have 2 projects sitting in a project group, one contains class's and collection of the class, ie class1 and class1s is the collection of class1.
running around the collection of class's within the project no problem, up in the front end get the message.
i am guessing this is an instancing error from the message.
thanks for all help
-
Aug 7th, 2001, 02:48 AM
#9
Fanatic Member
DLL
If you are needing the front end seperate from the framework, then consider slapping the framework code into an ActiveX DLL, then use this in the front end.
Laterz
Digital-X-Treme
Contact me on MSN Messenger: [email protected]
[VBCODE]Debug.Print Round(((1097) - ((55 ^ 5 + 311 ^ 3 - 11 ^ 3) _
/ (68 ^ 5))) ^ (1 / 7), 13)[/VBCODE]
-
Aug 7th, 2001, 02:57 AM
#10
i do understand that, the idea what i was trying to do was populate various collections of class's within a project and then in the front end run around these collections in the after they been populated in the back end.
i can polulate them no problem and run around them in the back end as i tested that out but i want to be able to do this in the front end.
maybe i am completly lost now, the principle of this sounded correct and very feasible, i thought i had done all the hard work in the back end and just had to make a call in the front end....
-
Aug 7th, 2001, 10:41 AM
#11
Addicted Member
It sounds like class1s and class1 need to have thier instancing property set to PublicNotCreatable.
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
|