Solved

type mismatch when passing class-structures to a custom control

Posted on 2002-04-11
4
252 Views
Last Modified: 2010-05-02
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

0
Comment
Question by:juggleking
  • 2
  • 2
4 Comments
 
LVL 1

Expert Comment

by:soferstam
ID: 6934771
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
 

Author Comment

by:juggleking
ID: 6935125
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
 
LVL 1

Accepted Solution

by:
soferstam earned 100 total points
ID: 6935209
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
 

Author Comment

by:juggleking
ID: 6936711
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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now