473,396 Members | 1,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Calling C# function inside VB.NET project

Hey folks, I have .NET Solution with the combinations of VB, C/C++ and C# projects on it. I have no problem calling C/C++ function inside my VB project but I dont know how to do the same with C# Project.

How to call C# function inside VB.NET?

Any help would be highly appreciated. Thank you
Jan 21 '08 #1
4 9230
Shashi Sadasivan
1,435 Expert 1GB
Hey folks, I have .NET Solution with the combinations of VB, C/C++ and C# projects on it. I have no problem calling C/C++ function inside my VB project but I dont know how to do the same with C# Project.

How to call C# function inside VB.NET?

Any help would be highly appreciated. Thank you
Im wondering how you are calling C/C++ functions from VB .Net directly
how have you included the files in the project?

you should convert it to a DLL file and then use it.
Jan 21 '08 #2
Hi Shashi...thanks for the reply

You are right, all of my C/C++ functions to be called inside my VB.NET are imported as DLL.

something like :
(C/C++ Side)
declaration:
MY_IMPORT_DLL unsigned int count_me_in();

definition:
unsigned int count_me_in(){
return let_me_in;
}

(VB Side)
Declare Function CountMeIn Lib "MyEventManager" Alias _count_me_in@0 As Integer()


That way, you can simply call those C/C++ Function inside VB. but i dont know how to import C# function since it doesnt have function declaration where you can define as imported dll.

Any idea?
Jan 21 '08 #3
Shashi Sadasivan
1,435 Expert 1GB
Create a new project of type Class library and choose c# as the language
copy those c# files in it, and compile it.
The DLL will be creating in the bin\Debug or bin\Release depends on what you choose.

Once you are back in the VB .Net project, import the DLL file u created from the steps above
Jan 21 '08 #4
Create a new project of type Class library and choose c# as the language
copy those c# files in it, and compile it.
The DLL will be creating in the bin\Debug or bin\Release depends on what you choose.

Once you are back in the VB .Net project, import the DLL file u created from the steps above
Okay, thank you very much, I'll try this tomorrow and I will let you know the result.

Thanks for the help *tiphat
Jan 21 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: GeRmIc | last post by:
Hi, I am trying to write a .NET Class Library which generates an XML file from the input parameters of all the functions that are called in a C DLL. (Everytime the GUI call the C DLL's...
1
by: ARTMIC | last post by:
Hello, could someone please help me out, i'm trying to call a Delphi 6.0 custom DLL from inside of a C# windows project. what am i doing wrong? i use the following declaration: public class...
5
by: z. f. | last post by:
Hi, I'm working on a web project and i create classes to do business logic and connect to DB. i also need a windows application to do the same functionality as defined in classes inside the...
1
by: Vijay | last post by:
Hi, I do have the VB.NET method which has delegate as parameter. I am calling this method from VB.NET project by using the commnad "Addressof( Function name which has same signature)". How can i...
6
by: Amjad | last post by:
Hi, I want to make a project that calls and executes a function (VB code) made in a seperate file in the Application Folder. I know I can create the function in my project and call it internally,...
7
by: Stu | last post by:
Hi, I have a web service which returns a record set and works well integrated with an asp dot net page. However if I decided to develop a unix app will i be able to read the dataset as it is...
3
by: Zongjun Qi | last post by:
Hey, In the book <Effective C++>, the author provides an example to prove why we need "pass by reference". I redoed the example, and found something interesting. The codes are:...
10
by: SQACPP | last post by:
Hi, I try to figure out how to use Callback procedure in a C++ form project The following code *work* perfectly on a console project #include "Windows.h" BOOL CALLBACK...
12
by: mcarthybn | last post by:
hi , I am working on huge C programming project.I am doin debugging only by printf measn i dont have any dubugger .So it is very difficult know who is actually calling a function and i am stuck...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.