Tavousi
Tavousi

Reputation: 15446

Use .dll files in winforms

I have a .dll file.I want to add this file to my program and use the component of its.(in C# & winforms) How do I can do this? Thanks.

Upvotes: 2

Views: 13096

Answers (4)

Javed Akram
Javed Akram

Reputation: 15344

Add reference from Solution Explorer (Remember you can add only managed code DLLs)
or
if using windows form you can also add control to Toolbox
Right Click on Toolbox ->Choose Items... ->Browse for your dll

Upvotes: 1

Chris
Chris

Reputation: 377

You should first put the .dll in your application folder. If there is an accompanying xml file, put that in there too. The XML file is the detailed comments so when you work with the .dll it will have explanations for things.

Right click on your project in solution explorer and choose add a reference. Choose the dll thats in your project.

If the dll is name Company.Description.dll, put a using command at the top of your code:

`using System.Drawing;

using System.Text;

using System.Windows.Forms;

using Company.Description;`

You should be able to see what the dll has added by typing in Company.desciption. hit control + space bar. The intellisense should show you what that dll contains.

Upvotes: 1

Colin Mackay
Colin Mackay

Reputation: 19175

Right click your WinForms project and say Add Reference, then browse to the DLL.

I tend to put any third-party DLLs in a folder called "Dependencies" inside my solution so that they are all kept together. It also makes it easier to move the solution around.

Upvotes: 8

Jeff LaFay
Jeff LaFay

Reputation: 13350

Add it as a reference to your project and then provide a using in any source file where you want to import the namespace to use the types within the DLL.

Upvotes: 2

Related Questions