.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Articles >> .Net Framework >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Creating a DLL file

Posted By:Syed Shakeer Hussain       Posted Date: September 19, 2010    Points: 25    Category: .Net Framework    URL: http://www.dotnetspark.com  

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




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




Now you can add you code what you need.Here I am taking one Return data type String function. This function I will use in another project (.aspx) and showing 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.



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




Adding created dll file to .asp solution:-

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


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.


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


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

Thanks for Reading my Article!


 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend