Link to home
Start Free TrialLog in
Avatar of mcs26
mcs26

asked on

Creating a DLL in CSharp in .Net

Hi,

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.

Thanks,

Mark

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



LibTest.doc
SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mcs26
mcs26

ASKER

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.
SimpleCalc-Ex.doc