Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a .dll in VB.Net

Status
Not open for further replies.

prgmrgirl

Programmer
Feb 12, 2004
119
US
Hi All,

I need to create a dll for creating barcodes. I have the code already for the barcode portion but I have never created a dll so I don't even know where to start or how to modify what I already have.

What I'd like to do is pass the .dll a string containing the upc and the dll should return a bitmap of the barcode to the calling program.

Does anyone know where I can get a good tutorial on creating dlls? Or if someone can give me a quick outline as to what I will need, that would be great.

What I have already: a windows form where you input the upc and click a button. The program returns the bitmap to a picture box on the form.

Thanks,
prgmrgirl
 
The quickest way to create a dll in visual studio is to create a new Class Library project (File -> New -> Project -> Visual Basic Projects).

This project will create an empty class file (basically the same type of class file that you would create in a Windows Application project). When you compile your project, Visual Studio will automatically create a dll file. If you want to have any visual components (GUI controls that a user can interact with) then you may want to create a new Windows Control Library project instead.

Jay
 
You are on the right track. You pretty much have all you need, you just need to strip some code out of your existing page and put it into a dll...

Create a new project and look for Class Library (this is the dll). Name it whatever you want, you can rename the class and the code page if you want as well.

You will then create a function that accepts your string and returns a bitmap (or an object or whatever)...

After you do this then build it and go back to your original project. Right click on "References" in the solution explorer and click add reference. Browse out to the "bin" folder of the project you just created for your class library and you should see the dll.

Create an instance of the class and then you will have all of the functions, methods, whatever from your dll at your disposal.

I hope I explained this correctly, if not then I will try to explain further. I am about to write a FAQ on a DLL I just created and a web service (which is pretty much the same as creating a dll) and I just started creating both about a week ago. It is pretty easy once you get into it.
 
First of all, thanks for the replies.

I have gotten as far as compiling into a dll. However, when I try to add it as a reference to an Access 2003 module, I am getting the error "Can't add a reference to the specified file." [sadeyes]

Is there something special I need to do to use this in Access? Any ideas as to what I might be doing wrong?

Thanks!

prgmrgirl
 
you will need to do very special things to use it in access.
try this thread

thread796-1070787

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
Using the thread that chrissie1 was kind enough to point me to, I was able to successfully use regasm to register my dll. However, I am having trouble making the dll work from an Access module. When I try to reference the dll, I can only reference the tlb AND it still won't create an object....

Run Time Error '429': ActiveX Component can't create object.

Help? Ideas?

Frankie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top