Creating a DLL in CSharp in .Net

Posted on 2011-10-21
Last Modified: 2013-11-17

I am trying to learn about create DLL's in CSharp. I came across the following website page and was trying to replicate the example. I have named my project "LibTest".

In my folder C:\Users\user\Documents\Visual Studio 2008\Projects\Mine\LibTest\LibTest\bin\Debug I have three files, LibTest.dll, LibTest.pdb &LibTest.tlb.

I made the LitTest.tlb file by using the following command prompts which I used from a previous question on here.

k ""C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat""
regasm /tlb:LibTest.tlb "C:\Users\user\Documents\Visual Studio 2008\Projects\Mine\LibTest\LibTest\bin\Debug\LibTest.dll"

When I go to Excel I can add the refernce by selecting the LibTest.tlb file. In the VBA editor when I define a variable objLib the intelliSense suggests the LibTest.Calc as a class. However my problem is when i use the line (shown below) objLib.SetNumberOne the intellisense doesn't pop up with any suggestions & nothing happens.

I read that I needed to use "codebase" with RegAsm. I tried this but could not do it. Please see the error message in the attached word document.

If you could also please explain in english what I'm actually doing that would be brillant.



Public Function test()
    Dim lngResult As Long
    Dim objLib As LibTest.Calc
    Set objLib = New LibTest.Calc
    objLib.SetNumberOne (3)
    objLib.SetNumberTwo (6)
    lngResult = objLib.Add()
End Function

Open in new window

Question by:mcs26
    LVL 69

    Assisted Solution

    by:Éric Moreau
    LVL 43

    Assisted Solution

    I don't think you can get intellisense support that way (or any easy way) with a custom dll.
    LVL 43

    Accepted Solution

    Oh - nothing to do with your code, your dll probably functions as you want it to do.

    Author Comment

    Hey thanks for the replies. I'm still not having any luck. I've attached a word document which hopefully explains my issue's better with screen shots.

    Again any help would be great.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now