AboutSyed Rizwan Muhammad Rizvi Expertise I can answers questions regarding web based and desktop based programming in VB.Net. Which can include SOAP, XML, Custom Controls, COM Interoperability etc.
Experience Have been working in this specific area for last 2 years previously I was a VB 6 Developer with experties in other languages as well. Total 10 years of programming experience.
Expert: Syed Rizwan Muhammad Rizvi Date: 1/22/2008 Subject: .NET and Visual Basic compatibility issue...
Question QUESTION: I have a C++ program that has a .NET wrapper. That .NET wrapper's functions are being called by a Visual Basic program. However, the Visual Basic code does not seem completely compatible with the C++ .NET code. I talked with the C++ experts here and they referred me to the Visual Basic section.
I have a class that returns data both in it's return and as pointers through it's arguments. Here is a sample class:
namespace TestNamespace
{
public ref class Status
{
int StatusResult;
String StatusResultDescription;
};
public ref class MyClass
{
MyClass();
~MyClass();
private:
double my_double_val;
public:
Status ^GetDoubleVal(double *DoubleVal, double TimeOut);
};
}
How do I properly access the function GetDoubleVal from an instance of the class in Visual Basic? Here is what I
Unfortunately, Visual Basic doesn't recognize the pointer argument or something for GetDoubleVal. It gives the following error:
"'GetDoubleVal' has a return type that is not supported or parameter types that are not suported."
I have looked at the call:
Private Declare Function GetDoubleValVB Lib "TestClass.dll" Alias "TestNameSpace.GetDoubleVal" _
(ByRef DoubleVal As Long, _
ByVal TimeOut As Long) As TestNameSpace.Status
But this won't connect to the class function and even if
it did, it wouldn't properly reference the class instance.
I would really appreciate any help you can provide.
- Donner
ANSWER: Is this code written in C++ .Net?
---------- FOLLOW-UP ----------
QUESTION: Yes, the .NET code is written in C++.NET.
- Donner
Answer If you add your vb.net project and C++.net in the same project, and create references to the c++ project in your vb.net project. Assuming that you classes are public in C++ you should be able to access all the methods using the typical Object Oriented way.