bool from VB6

J

Josh

Hi All,

I am writing a C# program that uses two OCX's from VB6.
A similar program works fine in VB6.
A function in OCX #1 is called using a reference to OCX #2.
While performing the function, I get a message box with the error:
"Type mismatch on Line 111"
When looking at the code, a call is made to a function in OCX #2 which
returns a boolean in VB6.
Could the back-and-forth in .NET have caused a mismatch in the bool
type (type size maybe)?
Is there a workaround?

Thanks,

Josh
 
O

Otis Mukinfus

Josh,

As you know, in VB 6.0 a bool uses the value -1 for true and 0 for
false.

You may have to do this:

bool b = false;

if(MyFunctionThatReturnsBool == -1)
{
b = true;
}
else
{
b = false;
}




Hi All,

I am writing a C# program that uses two OCX's from VB6.
A similar program works fine in VB6.
A function in OCX #1 is called using a reference to OCX #2.
While performing the function, I get a message box with the error:
"Type mismatch on Line 111"
When looking at the code, a call is made to a function in OCX #2 which
returns a boolean in VB6.
Could the back-and-forth in .NET have caused a mismatch in the bool
type (type size maybe)?
Is there a workaround?

Thanks,

Josh

Otis Mukinfus
http://www.otismukinfus.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top