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


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> ASP.NET Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

how to create sample dll ...program for beginers

Posted By:siri.k       Posted Date: March 12, 2011    Points: 40    Category: ASP.NET Controls    URL: http://www.dotnetspark.com  

simple dll creation for beginners using Visual Studio step by step
 


step 1)

//open microsoft vs 2010  -> new prj -> class library ->name ->dll
// page open then write code like this here we r creating dll for addition of two numbers..

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace dll
{
    public class Class1
    {

        public int add(int a, int b)
        {
            int c;
            c = a + b;
            return c;
        }
    }
}

// a dll file will created in folder where u save this

// go to path where u save this class lib prj -> goto bin -> debug -> dll ** file is availble....



step 2)

then open vs 2010 express in that -> new prj -> wpf application-> give name to the appl

page will open, and the add the refernce to this for adding ref go to sol explorer right clik refernce add refence ->dll** which we had created earlier.


 in XAML design  page just take three text boxes one for varible a another for b and the third one to store the result...

one button...after button clik jus write the code in Xaml.cs file...............


  private void button1_Click(object sender, RoutedEventArgs e)
        {
           
            dll.Class1 ob = new dll.Class1();
            int a = Convert.ToInt32(textBox1.Text);
            int b = Convert.ToInt32(textBox2.Text);
            textBox3.Text = ob.add(a, b).ToString();
    
           
        }


hmm lastly see the ouput

this is sample dll program for beginners..................................................


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

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