Solved

type mismatch when passing class-structures to a custom control

Posted on 2002-04-11
4
256 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

920 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

16 Experts available now in Live!

Get 1:1 Help Now