how to call function in a DLL

Discussion in 'C#' started by pmann461, Feb 11, 2010.

  1. pmann461

    pmann461 New Member

    Joined:
    Feb 11, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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.
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    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
     
  3. blackrubybarb

    blackrubybarb New Member

    Joined:
    Oct 28, 2010
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    .NET Developer
    Location:
    Sri Lanka
    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
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice