'Creating A Shared Assembly in .NET
public class SharedObject
Public Function Greeting(ByVal name as String) As String
Return ("SharedObject says Hi : " & name )
End Function
End Class

Recommended Answers

You need a Client to call that method that was written in VB?
If so, and you have the dll of that assembly:
Did you add it as a reference in your C++ project?

Jump to Post

All 2 Replies

You need a Client to call that method that was written in VB?
If so, and you have the dll of that assembly:
Did you add it as a reference in your C++ project?

1) Create a C++/CLI project (preferably a CLR Console Application)
2) Add a new project to that workspace (file->Add->New Project)
- Make the new project a Visual Basic Class Library
- Paste the code you have above into that VB module
3) In the C++ project, add a reference to the VB project
- Project->References->Add New Reference / [Projects] (choose your VB project name)
4) Add a "using namespace (and the name of your vb project);" //to your C++ code
5) Add something to call the routine like this:

#include "stdafx.h"
using namespace System;
using namespace DW_405037_VB_DLL;
int main(array<System::String ^> ^args)
{
    SharedObject^ so = gcnew SharedObject();
    Console::WriteLine(so->Greeting("Fred"));
    return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.