Click here to Skip to main content
14,695,505 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This may be easy but i could not find how to fix it.

I have a vb .net dll which calls vb6 exe. In vb6, enum members can be called directly without using enumeration name.
But in vb .net, i need to use enum name to call members of it.

VB6 exe calls memebrs of enum directly without using enum name which fails when it comes to vb .net dll.
FYI, i cannot change code of vb6.

public class

public enum test
undefined = 0
critical = 1
end enum

end class

Call from vb6 exe:

i = class(critical)

this line directly calls critical and give 1 as value for i, when i used vb 6 dll as reference to vb6 exe

but when it comes to vb .net dll, the above condition fails saying "critical" variable not defined
Mike Meinz 12-Nov-13 18:02pm
You don't show your .NET code so it is impossible to tell what is happening there.

1 solution

Of course it is not defined.

It's defined within the VB6 class not your VB.NET code.

You either have to fully qualify it ... e.g. classname.Critical (that syntax is probably wrong by the way - I'm not wasting time checking it), define something similar in your VB.NET DLL or just pass the value of 1
CHill60 12-Nov-13 17:57pm
Then why did you post "I have a vb .net dll which calls vb6 exe". It clearly isn't defined in the code or you wouldn't get '"critical" variable not defined'. Make sure you've spelled it correctly and in the right case. Or do as you have already discovered and fully qualify the name
Sergey Alexandrovich Kryukov 12-Nov-13 18:08pm
Good advice, 5 ed. OP just goes in wrong direction, but you are perfectly right.
Sergey Alexandrovich Kryukov 12-Nov-13 18:11pm
Maybe you simply need to understand that that "perfectly fine" is not fine at all.
Note that using VB6 puts your whole business in jeopardy. It could be much better to get rid of that component at all. Are you the one who told us that you don't even have source code? Using something without source code is already unacceptable from the stand point of securing the business, and if this is also VB6, it cannot be considered seriously...
CHill60 12-Nov-13 18:13pm
Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900