We help IT Professionals succeed at work.

enum type in C++ and VB?

MohammadA asked
I am developping C++ client component that use VB component as a server, some properties and methods in the VB component(server side)has a parameters of type enum ,I created the same enum type in the C++ client; when I call VB functions that accept parameter of enum type from C++ component I send the enum type that i created in the C++ but I have got a compilation error like that :

error: cannot convert parameter 1 from 'enum C++Class::enumtype' to 'enum VBClass::enumtype'

NOTE:suppose C++ class is C++Class ,VB class is VBClass
and enumeration name is enum type.
Watch Question

Post the relevant code

Who is giving you that error? VB? VC?


VC gives me the error.Sorry I can not post the code.

sorry, we can't help you.
Hi MohammadA,
did you have a look into .tli & .tlh files which are produced by compiler when the #import is used ?
If you have declared your enum within the VB component it should appear somewhere in those files... So you don't need declare new enum type. If they are not there then they probably were not correctly declared in VB. You can still try to use your VC enum type but then you will probably convert VC to VB types explicitly like:

Explore More ContentExplore courses, solutions, and other research materials related to this topic.