If there is some reusable code ,which has to be used in more than one application,instead of specify the same code again and again,we can make a DLL File. DLL can not be execute independently.
Step2:- First open solution Explorer->Right click on dll exampe->Add Reference->click on .NET->Select System.Windows.Forms->click OK.
Step3:- Write the following code which are given below:-
Step5:- Now again open New Project->Select WindowsFormsApplication-> Click OK->Make the design which is as shown below:-
Step6:- Open Solution Explorer->Right click on solution Explorer->Click Add Reference->select Browse->Go dllexample File->Bin->Debug->select dlleample->OK.
Step7:- Double click on Getsum and Getmultiple button and write the following which are given below.
Step7:- Now Run the program (press F5) ,the output of program is shown below :-
see it:-
.
For More:-
I hope this is helpful for you.
Download whole Attached application.
DOWNLOAD
There are some steps to make a .dll file and use it in .Net Application.Please follow steps one by one which are given below.
Step1:- First open your visual studio->go File->New Project->Select class Library->Click OK.
Step2:- First open solution Explorer->Right click on dll exampe->Add Reference->click on .NET->Select System.Windows.Forms->click OK.
Step3:- Write the following code which are given below:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace dllexample
{
public class Class1
{
public void sum(int i, int ii)
{
int res = i + ii;
MessageBox.Show(res.ToString());
}
public void multi(int i, int ii)
{
int res = i *ii;
MessageBox.Show(res.ToString());
}
}
}
Step:4- Compile the program (Press F6).Step5:- Now again open New Project->Select WindowsFormsApplication-> Click OK->Make the design which is as shown below:-
Step6:- Open Solution Explorer->Right click on solution Explorer->Click Add Reference->select Browse->Go dllexample File->Bin->Debug->select dlleample->OK.
Step7:- Double click on Getsum and Getmultiple button and write the following which are given below.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
dllexample.Class1 obj = new dllexample.Class1();
int a=Convert.ToInt32(textBox1.Text);
int b=Convert.ToInt32(textBox2.Text);
obj.sum(a,b);
}
private void button2_Click(object sender, EventArgs e)
{
dllexample.Class1 obj = new dllexample.Class1();
int a= Convert.ToInt32(textBox3.Text);
int b = Convert.ToInt32(textBox4.Text);
obj.multi(a,b);
}
}
}
see it:Step7:- Now Run the program (press F5) ,the output of program is shown below :-
see it:-
.
For More:-
- File Handling Real Application
- Ado.Net Application
- Xml Application
- How to implement Web Form controls in asp.net
- How to implement caching and ajax feature in web services
- How to create constraints in ado.net application
- Navigation controls in asp.net
- Create setup file with database
- Projects on e-post system in asp.net
- How to Create data set and data adapter
- Abstract class and abstract method in c#
- How to use multiple main method in c#
I hope this is helpful for you.
Download whole Attached application.
DOWNLOAD
Thank you very much for you can share your post,the article content written very well,extremely is worth my study.
ReplyDeletegood post...
ReplyDeletesuperb explanation thank you
ReplyDeletesimple and good one, thx a lot...
ReplyDeleteIt is possible to download missing DLL files from Fix4dll.com and avoid seeing the most expected error messages like "Msvcr110.dll is missing" or "D3dx9_39.dll is missing".
ReplyDeleteThanks for sharing this informative blog. I am extremely happy to find this blog as it contains unique information on what I am finding for many days. You have briefly explained how to create a DLL File and using it in .NET application. I have read a blog few days back on DLL Files and How they actually work. I must say it is a worth reading blog!
ReplyDelete