type mismatch when passing class-structures to a custom control

Hello,

I have created some class structures that are the base elements of a program that i am writing .

A part of this program should also be a custom control . That also uses this same base classes .

When want to pass the base-classes to the custom control i get a 'type mismatch error' . Nevertheless it are the same classes .

    Call ucObsCalc.SetMembers(myChart, myServerClientBinding, _
        nMyPatKey, sMyPatCode, sMyPatName, _
        dPDate, sMyUser, nMyUserLang, _
        sMyCentDir, "localhost", 2020)

The problem is situated in the myChart-Class, that because i also have
written a public SetMembersDummy function without the myChart , and then i
don't get a type mismatch .

The BaseClasses i have written are in a exe-project where everything is
PRIVATE . In the custom control on the other hand all the parameters that
should be passed have to be public . Is this why he complains ?

Is there anybody that can give me some advice ? This can't be so hard , ...
It's only the first time i do it ...

Hoping to hear from you .

Filip W.
C3

jugglekingAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
soferstamConnect With a Mentor Commented:
In both projects you have to include the same ClsStrucChart .You can not include different class module to use this way even with the same type name and members.
You can:
-Public Sub SetMembers(ByRef pClsChart As OBJECT,
or
-Include the same class.You will have to change the instansing to as least private
or
-Make a dll,better with interface,and implement this interface in custom control.Then you can use  As ClsStrucChart

Did I usderstand the question?
0
 
soferstamCommented:
Sorry,could not understand the question.
Is it same project,project group or you are inserting control using 'Components' tab?
What type is myChart of?
How did you declare ucObsCalc.SetMembers?
0
 
jugglekingAuthor Commented:
Hello,

MyChart is a Class Module of type ClsStrucChart . I want to pass a ClsStrucChart object to another custom control project that uses the same Class Module definitions of ClsStrucChart .

In my custom control project I have set ClsStrucChart to PublicNotCreatable , and NotPersistable , also al the other Objects that are passed I have set to the same values .

The moment i Call the SetMembers Function I get an error .

It's defined like this ... Public Sub SetMembers(ByRef pClsChart As ClsStrucChart,ByRef ... , ... )

(some byref and some byval) .

The UserControl is compiled to an ocx. And With 'project/components' I have put it on a dialogbox . Where I need to pass some objects to the cc .

Any suggestions ?

hoping to hear from you .

Filip W.




 

 
0
 
jugglekingAuthor Commented:
Hello,

Yes you did understand the question .

The first option did not work . It gave me the same error .

The Second , .. I don't understand . I always used the same classes , and setting the clsstrucchart private in the ocx class simply does not work .

The thierd ,option did work . And that's what I am using right now . But I am not really satisfied with it . I don't like the idea that I have to recompile my ClsStrucChart Class everthing something changes .



0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.