Click here to Skip to main content
15,902,863 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
how to add DLL in project.my dll contains.
C#
public class MyClass1
   {
       public static string MyHelloMethod()
       {
           return "Hello World";
       }

   }

and i want it to use in project to display in label.how to do it?
Posted
Updated 6-Sep-11 0:52am
v2

Add your DLL file using Add Reference and use below code in your Project

C#
using DllCreate;  // Namespace of your dll

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Label1.Text = Myclass1.MyHelloMethod();

    }
}
 
Share this answer
 
Comments
raj_sagoo 6-Sep-11 7:55am    
thanks alot..got it
To create an assembly you will need to create a project class library project. In this project you will create your reportclass.vb class file. When you build this it will produce the DLL file. Unfortuantely you cannot create web pages in this type of project.
Now to use this in your website you can either add a project reference to this class library project, or add a file reference to the DLL it produced.
http://forums.asp.net/t/1281911.aspx/1[^]
 
Share this answer
 
Comments
raj_sagoo 6-Sep-11 7:11am    
but i can call this project or dll in webpage?
raj_sagoo 6-Sep-11 7:12am    
can you provide me the code.
Prerak Patel 6-Sep-11 7:29am    
What code you are asking for?
raj_sagoo 6-Sep-11 7:57am    
i got it..:)
Hi raj_sagoo,
Here is the video link for creating and adding Dll in the project.
Click Here
 
Share this answer
 
A step by step tutorial can be found here: http://msdn.microsoft.com/en-us/library/ms235636(v=VS.90).aspx[^]
 
Share this answer
 
Comments
Legor 8-Sep-11 3:00am    
Some troll giving out downvotes here?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900