473,799 Members | 3,810 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling C# function inside VB.NET project

4 New Member
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 9258
Shashi Sadasivan
1,435 Recognized Expert Top Contributor
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
MasterVision
4 New Member
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 Recognized Expert Top Contributor
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
MasterVision
4 New Member
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
1741
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 function, I try to generate an XML file of the function called together with the parameters, this means calling the XML generating .NET library inside every function of the C DLL) When I try to access the function like GenXML::WriteXmlFile *myfile = new...
1
7273
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 WindowDesignerForm : System.Windows.Forms.Form { static extern double CalcWindow(long OrderNum, long WinNum); etc...
5
1578
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 ASP.NET project. when i reference the web project DLL (inside the BIN directory) I successfully make a call to a function and get return value. but this is just a test and when trying to access the application
1
1741
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 call the same method from C# Project? Code Sample: Delegate Definition on class inwhich VB.NET method is located. Public Delegate Function fnRejectDelegate(ByVal dr As DataRow) As Boolean
6
1709
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, but I want to put the function's code in an external file, so that future updates to the function will require a replacing the function file instead of re-installing the whole project. Can you give me ideas on how I can make small updates to my...
7
6019
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 or do i need to write the xml as text from the web service and supply a DTD. Also any other pitfalls TIA
3
1568
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: ############################## #include <iostream> class Student{ public:
10
7001
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 MyEnumWindowsProc(HWND hwnd, LPARAM lparam) {
12
31901
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 in a problem that , i have seen that one fucntion is get called by from some 160 postions. and i need to solve some problem and it is very probmatic to get print from 160 postions.So ,is there any way to get to know who is calling that function in...
0
9687
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9543
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10029
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9077
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7567
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6808
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4144
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.