SIGN UP MEMBER LOGIN:    
ARTICLE

How to Create a DLL file in .NET Framework using Visual Studio

Posted by Syed Shakeer Articles | Visual Studio .NET January 31, 2011
This article will show how to create a DLL file in .NET framework using Visual Studio
Reader Level:


This article will show how to create a DLL file in .NET framework using Visual Studio.

Creating a dll file

To create a DLL follow the below steps

Open 'Visual Studio' and select File -> Open -> New ->Project

1.gif

Click on OK Button. Once you click on Ok 'Button' your Class Library looks as
follows.

2.gif

Now you can add whatever code that you need to. Here I have String as the return data type for the function. I will use this function in another project (.aspx) and show the Result in a TextBox.

namespace MyClassLibraryConsole
{
public class Class1
{
     
public string strfunction(string input)
{
string strmessage = input;
return strmessage;
}
}
}

Now you have to call this function in another project. Add New (or) Existing Project to your Solution. Here I am adding Existing .asp WebPages to my solution as follows.

3.gif

Once you have added your New or Existing Project your Solution will looks as follows.

4.gif

Adding created dll file in Solution Explorer:

Right click on DllDemo(.asp) solution and click on the select 'Add Reference'.

5.gif

Now you can find dialog Box. Select 3rd tab 'Projects'. Now can find your created ClassLibrary (dll) as 'MyClassLibraryconsole'.Select it and click 'OK' button.

6.gif

Now your dll is added successfully to your website. You can see your added dll in solution Explorer.

7.gif

Calling dll file function in .aspx.cs page:

protected void Button1_Click(object sender, EventArgs e)
{
  MyClassLibraryConsole.
Class1 obj = new MyClassLibraryConsole.Class1();
  TextBox1.Text = obj.strfunction(
"Hellow World");
}

Showing the Result in TextBox:

8.gif

Thanks for Reading my Article!

Shakeer

erver'>
Login to add your contents and source code to this article
share this article :
post comment
 

i m installing microsoft visual studio 2008. i treid many times but all time it is going to be failed i dont know why it is failing again n agian... nad it gives an error in a small dialog box that ENU is encournterd an error..... plz solve it

Posted by tAhIra sgd Mar 11, 2011

Very Good Article....... thankx for sharing........

Posted by Manish Tewatia Feb 02, 2011

very good.......article..thanks

Posted by sarfaraj Md Feb 02, 2011

very good process..................thanks.

Posted by sarfaraj Md Feb 02, 2011

Yes Topic is "How to create dll" but content is about how to use them..Bad

Posted by shunmugha sundaram Feb 02, 2011
Nevron Gauge for SharePoint
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Team Foundation Server Hosting
Become a Sponsor