Solved

type mismatch when passing class-structures to a custom control

Posted on 2002-04-11
4
262 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
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…
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…

707 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