Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 484
  • Last Modified:

Creating a DLL in CSharp in .Net


I am trying to learn about create DLL's in CSharp. I came across the following website page http://www.geeksengine.com/article/create-dll.html 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

  • 2
3 Solutions
Éric MoreauSenior .Net ConsultantCommented:
I don't think you can get intellisense support that way (or any easy way) with a custom dll.
Oh - nothing to do with your code, your dll probably functions as you want it to do.
mcs26Author Commented:
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.

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now