Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

type mismatch when passing class-structures to a custom control

Posted on 2002-04-11
4
Medium Priority
?
275 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 300 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

610 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