how to call function in a DLL

pmann461's Avatar, Join Date: Feb 2010
Newbie Member
Question from Newbie:
I want to create a DLL called AddOne.DLL that has one function in it called "OneMore" that accepts an integer as input and returns the next greatest integer value (ie: if i pass it 212, i want it to return 213). I then want to call this from a windows forms application.

My question is:
1) how do i create a function that returns a value.
2) how do i call this external function from another C# windows forms app.

This is probably the dumbest question ever posted, but i am an old VB programmer and all this is new to me.
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Not actually.

Import the DLL and use it.

It should be just like System. statements and then function call would be like any other in built function call
blackrubybarb's Avatar, Join Date: Oct 2010
Light Poster
create a class library and write your functions in that class library
then import the .DLL file to windows forms app and then you can create an object using that class in the dll file. using that object you can call any function