Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Status Updates

View All Updates

- - - - -

Managed C++ calling VB .net dll function

Managed C++ form

  • Please log in to reply
1 reply to this topic

#1 pranab73


    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 25 December 2007 - 10:19 AM

Hi all,

I am newbie to .NET technology, but through some forum I know that it is possible to call VB .Net call function calls from a managed C++ code. The VB .Net code is some what like this which is in Sample.vb

using System
Public class Test
Public Function getName(ByVal fsName as String) as String
Dim lsReturn as String
lsReturn = "Welcome " & fsName
Return lsReturn
End Function
End class

I need to call getName function form managed C++ code, so please let me know how this can be achived or any sample piece of code.

Would appreciate for the same.

Thanks & Regards

Pranab Bhatta
  • 0

#2 kernelcoder


    CC Devotee

  • Expert Member
  • PipPipPipPipPipPip
  • 990 posts
  • Location:Dhaka
  • Programming Language:C, Java, C++, C#, Visual Basic .NET
  • Learning:Objective-C, PHP, Python, Delphi/Object Pascal

Posted 25 April 2012 - 07:51 AM

You can do it by following way.
  • Right click your managed C++ projects --> Properties -->Common Properties --> Framework & References
  • Click on 'Add New Reference' button
  • Now from the 'Add Reference' window, select 'Projects' tab if your VB code is a class library in the same solution of your managed C++ project and select the vb project from the list. If your VB code is in a separate library/dll, select 'Browse' tab and browse the VB dll/library.
Now you can use the VB code as follows in your managed c++ code.
// This code considers that your VB code's Test class is in VBClassLibrary namespace

VBClassLibrary::Test^ test = gcnew VBClassLibrary::Test();
test->getName("string argument");

  • 0

Also tagged with one or more of these keywords: Managed C++, form

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download