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.
{
public class Class1}
{
public string strfunction(string input)}
{string strmessage = input;
return strmessage;
}
Once you added your New or Existing Project your Solution will looks as follows
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
No comments:
Post a Comment