SlideShare une entreprise Scribd logo
1  sur  5
Télécharger pour lire hors ligne
Creating & consuming Simple Component using C# - Nithiyapriya P Page 1
Enterprise Applications using C# : Component
A component is a reusable piece of code and is in the form of “DLL”. Once a
component is designed , it can be reused from any kind of applications such as console
applications, web applications or windows applications.
A component is a collection of one or more classes that are compiled together as unit.
For example, “System.web.dll ” is a single component that provides the objects found in
many of the System.web namespace.
End user cannot interact with the DLL directly; user can interact with applications and
the applications will interact with the component or dll.
By creating component you are actually creating assembly file and it has all the
benefits that assembly has. You can edit all the assembly details by right clicking "Class
Library Project" and Selecting Properties from popup window
Creating Simple Component
1. Start visual studio 2012
2. File -> new Project-> Visual C# -> Class Library. Select the location where you wants
to save your project & and name it.
Creating & consuming Simple Component using C# - Nithiyapriya P Page 2
3. Rename the class1.cs as Calculate.cs and add coding for add, sub, mul, div methods
as given below.
Calculator.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Calculator
{
public class Calculate
{
public int Add(int a, int b)
{
return a + b;
}
public int Sub(int a, int b)
{
Creating & consuming Simple Component using C# - Nithiyapriya P Page 3
return a - b;
}
public int Mul(int a, int b)
{
return a * b;
}
public int Div(int a, int b)
{
return a / b;
}
}
}
4. Save & build Calculator
5. Now we have created calculator.dll. (you can verify it in your bindebug directory of
your class library project)
6. Goto solution explorer, Right click ; Add - > new Project-> visual c#->windows form
Application: Give a name and click ok.
7. Design your form for arithmetic calculation as given in form design.
8. Goto solution explorer. Right click on Windows form application- >Add Reference -
> browse for the calculate.dll file; check it and add to your project.
Creating & consuming Simple Component using C# - Nithiyapriya P Page 4
9. Now you can see “Calculator” under the references folder.
10. Add “using calculator” namespace on form1.cs and add the following code as given
below.
Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Calculator;
namespace Minicalculator
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Calculate cal = new Calculate();
private void Form1_Load(object sender, EventArgs e)
{
}
private void Add_Click(object sender, EventArgs e)
{
int i = cal.Add(int.Parse(Txt1stNo.Text), int.Parse(Txt2ndNo.Text));
TxtResult.Text = i.ToString();
Creating & consuming Simple Component using C# - Nithiyapriya P Page 5
}
private void Sub_Click(object sender, EventArgs e)
{
int i = cal.Sub(int.Parse(Txt1stNo.Text), int.Parse(Txt2ndNo.Text));
TxtResult.Text = i.ToString();
}
private void Mul_Click(object sender, EventArgs e)
{
int i = cal.Mul (int.Parse(Txt1stNo.Text), int.Parse(Txt2ndNo.Text));
TxtResult.Text = i.ToString();
}
private void Div_Click(object sender, EventArgs e)
{
int i = cal.Div (int.Parse(Txt1stNo.Text), int.Parse(Txt2ndNo.Text));
TxtResult.Text = i.ToString();
}
private void button1_Click_1(object sender, EventArgs e)
{
this.Close();
}
}
}
11. Save the project
12. Right click on the current project and select “set as startup project” and run the
project.

Contenu connexe

Tendances

Unit 4 designing classes
Unit 4  designing classesUnit 4  designing classes
Unit 4 designing classesgopal10scs185
 
Communication primitives
Communication primitivesCommunication primitives
Communication primitivesStudent
 
Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Ravindra Raju Kolahalam
 
Dynamic and Static Modeling
Dynamic and Static ModelingDynamic and Static Modeling
Dynamic and Static ModelingSaurabh Kumar
 
Data Storage In Android
Data Storage In Android Data Storage In Android
Data Storage In Android Aakash Ugale
 
MULTI THREADING IN JAVA
MULTI THREADING IN JAVAMULTI THREADING IN JAVA
MULTI THREADING IN JAVAVINOTH R
 
Components of .NET Framework
Components of .NET FrameworkComponents of .NET Framework
Components of .NET FrameworkRoshith S Pai
 
Architecture of .net framework
Architecture of .net frameworkArchitecture of .net framework
Architecture of .net frameworkThen Murugeshwari
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivityTanmoy Barman
 
Android notification
Android notificationAndroid notification
Android notificationKrazy Koder
 
Classes and Objects
Classes and Objects  Classes and Objects
Classes and Objects yndaravind
 
10 implementing subprograms
10 implementing subprograms10 implementing subprograms
10 implementing subprogramsMunawar Ahmed
 
Deadlock in distribute system by saeed siddik
Deadlock in distribute system by saeed siddikDeadlock in distribute system by saeed siddik
Deadlock in distribute system by saeed siddikSaeed Siddik
 
Architecture design in software engineering
Architecture design in software engineeringArchitecture design in software engineering
Architecture design in software engineeringPreeti Mishra
 
Creational pattern
Creational patternCreational pattern
Creational patternHimanshu
 
Peephole optimization techniques in compiler design
Peephole optimization techniques in compiler designPeephole optimization techniques in compiler design
Peephole optimization techniques in compiler designAnul Chaudhary
 
Object oriented software engineering concepts
Object oriented software engineering conceptsObject oriented software engineering concepts
Object oriented software engineering conceptsKomal Singh
 

Tendances (20)

Unit 4 designing classes
Unit 4  designing classesUnit 4  designing classes
Unit 4 designing classes
 
Communication primitives
Communication primitivesCommunication primitives
Communication primitives
 
Java Notes
Java NotesJava Notes
Java Notes
 
Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]
 
Dynamic and Static Modeling
Dynamic and Static ModelingDynamic and Static Modeling
Dynamic and Static Modeling
 
Data Storage In Android
Data Storage In Android Data Storage In Android
Data Storage In Android
 
MULTI THREADING IN JAVA
MULTI THREADING IN JAVAMULTI THREADING IN JAVA
MULTI THREADING IN JAVA
 
Components of .NET Framework
Components of .NET FrameworkComponents of .NET Framework
Components of .NET Framework
 
Architecture of .net framework
Architecture of .net frameworkArchitecture of .net framework
Architecture of .net framework
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
 
Android notification
Android notificationAndroid notification
Android notification
 
Classes and Objects
Classes and Objects  Classes and Objects
Classes and Objects
 
10 implementing subprograms
10 implementing subprograms10 implementing subprograms
10 implementing subprograms
 
Deadlock in distribute system by saeed siddik
Deadlock in distribute system by saeed siddikDeadlock in distribute system by saeed siddik
Deadlock in distribute system by saeed siddik
 
Architecture design in software engineering
Architecture design in software engineeringArchitecture design in software engineering
Architecture design in software engineering
 
Creational pattern
Creational patternCreational pattern
Creational pattern
 
Peephole optimization techniques in compiler design
Peephole optimization techniques in compiler designPeephole optimization techniques in compiler design
Peephole optimization techniques in compiler design
 
android menus
android menusandroid menus
android menus
 
Object oriented software engineering concepts
Object oriented software engineering conceptsObject oriented software engineering concepts
Object oriented software engineering concepts
 
Tcp/ip server sockets
Tcp/ip server socketsTcp/ip server sockets
Tcp/ip server sockets
 

Similaire à Creating simple component

Dbva dotnet programmer_guide_chapter8
Dbva dotnet programmer_guide_chapter8Dbva dotnet programmer_guide_chapter8
Dbva dotnet programmer_guide_chapter8Shakeel Mujahid
 
Visual studio 2012
Visual studio 2012Visual studio 2012
Visual studio 2012Kiru Dennis
 
Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0sanket1996
 
Login Project with introduction .pptx
Login Project with introduction .pptxLogin Project with introduction .pptx
Login Project with introduction .pptxkulmiyealiabdille
 
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptxhjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptxEliasPetros
 
Membangun Desktop App
Membangun Desktop AppMembangun Desktop App
Membangun Desktop AppFajar Baskoro
 
PT1420 File Access and Visual Basic .docx
PT1420 File Access and Visual Basic                      .docxPT1420 File Access and Visual Basic                      .docx
PT1420 File Access and Visual Basic .docxamrit47
 
WP7 HUB_Introducción a Visual Studio
WP7 HUB_Introducción a Visual StudioWP7 HUB_Introducción a Visual Studio
WP7 HUB_Introducción a Visual StudioMICTT Palma
 
visual basic for the beginner
visual basic for the beginnervisual basic for the beginner
visual basic for the beginnerSalim M
 
iPhone application development training day 1
iPhone application development training day 1iPhone application development training day 1
iPhone application development training day 1Shyamala Prayaga
 
Unit -II Introduction to visual programming.pdf
Unit -II Introduction to visual programming.pdfUnit -II Introduction to visual programming.pdf
Unit -II Introduction to visual programming.pdfUjwala Junghare
 
Containers Lab
Containers Lab Containers Lab
Containers Lab Dev_Events
 

Similaire à Creating simple component (20)

Dbva dotnet programmer_guide_chapter8
Dbva dotnet programmer_guide_chapter8Dbva dotnet programmer_guide_chapter8
Dbva dotnet programmer_guide_chapter8
 
Visual studio 2012
Visual studio 2012Visual studio 2012
Visual studio 2012
 
Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0
 
Login Project with introduction .pptx
Login Project with introduction .pptxLogin Project with introduction .pptx
Login Project with introduction .pptx
 
Lab Manual (5).docx
Lab Manual (5).docxLab Manual (5).docx
Lab Manual (5).docx
 
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptxhjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
 
Membangun Desktop App
Membangun Desktop AppMembangun Desktop App
Membangun Desktop App
 
Vb basics
Vb basicsVb basics
Vb basics
 
PT1420 File Access and Visual Basic .docx
PT1420 File Access and Visual Basic                      .docxPT1420 File Access and Visual Basic                      .docx
PT1420 File Access and Visual Basic .docx
 
C# with Renas
C# with RenasC# with Renas
C# with Renas
 
Cp e 214_appendix_c
Cp e 214_appendix_cCp e 214_appendix_c
Cp e 214_appendix_c
 
Visual programming
Visual programmingVisual programming
Visual programming
 
WP7 HUB_Introducción a Visual Studio
WP7 HUB_Introducción a Visual StudioWP7 HUB_Introducción a Visual Studio
WP7 HUB_Introducción a Visual Studio
 
visual basic for the beginner
visual basic for the beginnervisual basic for the beginner
visual basic for the beginner
 
Vb.net ide
Vb.net ideVb.net ide
Vb.net ide
 
C# p1
C# p1C# p1
C# p1
 
Tutorial 1
Tutorial 1Tutorial 1
Tutorial 1
 
iPhone application development training day 1
iPhone application development training day 1iPhone application development training day 1
iPhone application development training day 1
 
Unit -II Introduction to visual programming.pdf
Unit -II Introduction to visual programming.pdfUnit -II Introduction to visual programming.pdf
Unit -II Introduction to visual programming.pdf
 
Containers Lab
Containers Lab Containers Lab
Containers Lab
 

Plus de priya Nithya

Android Architecture.pptx
Android Architecture.pptxAndroid Architecture.pptx
Android Architecture.pptxpriya Nithya
 
Html server control - ASP. NET with c#
Html server control - ASP. NET with c#Html server control - ASP. NET with c#
Html server control - ASP. NET with c#priya Nithya
 
Modes of transfer - Computer Organization & Architecture - Nithiyapriya Pasav...
Modes of transfer - Computer Organization & Architecture - Nithiyapriya Pasav...Modes of transfer - Computer Organization & Architecture - Nithiyapriya Pasav...
Modes of transfer - Computer Organization & Architecture - Nithiyapriya Pasav...priya Nithya
 
Asynchronous data transfer
Asynchronous data transferAsynchronous data transfer
Asynchronous data transferpriya Nithya
 
Asp.net state management
Asp.net state managementAsp.net state management
Asp.net state managementpriya Nithya
 
HTTP REQUEST RESPONSE OBJECT - WEB APPLICATION USING C# LAB
HTTP REQUEST RESPONSE OBJECT - WEB APPLICATION USING C# LABHTTP REQUEST RESPONSE OBJECT - WEB APPLICATION USING C# LAB
HTTP REQUEST RESPONSE OBJECT - WEB APPLICATION USING C# LABpriya Nithya
 
HTML SERVER CONTROL - ASP.NET WITH C#
HTML SERVER CONTROL  - ASP.NET WITH C#HTML SERVER CONTROL  - ASP.NET WITH C#
HTML SERVER CONTROL - ASP.NET WITH C#priya Nithya
 
Android LAb - Creating an android app with Radio button
Android LAb - Creating an android app with Radio buttonAndroid LAb - Creating an android app with Radio button
Android LAb - Creating an android app with Radio buttonpriya Nithya
 
ASP.NET - Life cycle of asp
ASP.NET - Life cycle of aspASP.NET - Life cycle of asp
ASP.NET - Life cycle of asppriya Nithya
 
Web application using c# Lab - Web Configuration file
Web application using c# Lab - Web Configuration fileWeb application using c# Lab - Web Configuration file
Web application using c# Lab - Web Configuration filepriya Nithya
 
Creation of simple application using - step by step
Creation of simple application using - step by stepCreation of simple application using - step by step
Creation of simple application using - step by steppriya Nithya
 
Adaptation of tcp window
Adaptation of tcp windowAdaptation of tcp window
Adaptation of tcp windowpriya Nithya
 
Key mechanism of mobile ip
Key mechanism of mobile ip Key mechanism of mobile ip
Key mechanism of mobile ip priya Nithya
 
Mobile ip overview
Mobile ip overviewMobile ip overview
Mobile ip overviewpriya Nithya
 
Features of mobile ip
Features of mobile ipFeatures of mobile ip
Features of mobile ippriya Nithya
 
Creating a Name seperator Custom Control using C#
Creating a Name seperator Custom Control using C#Creating a Name seperator Custom Control using C#
Creating a Name seperator Custom Control using C#priya Nithya
 
How to Create Database component -Enterprise Application Using C# Lab
How to Create Database component -Enterprise Application Using C# Lab  How to Create Database component -Enterprise Application Using C# Lab
How to Create Database component -Enterprise Application Using C# Lab priya Nithya
 

Plus de priya Nithya (19)

Android Architecture.pptx
Android Architecture.pptxAndroid Architecture.pptx
Android Architecture.pptx
 
Html server control - ASP. NET with c#
Html server control - ASP. NET with c#Html server control - ASP. NET with c#
Html server control - ASP. NET with c#
 
Modes of transfer - Computer Organization & Architecture - Nithiyapriya Pasav...
Modes of transfer - Computer Organization & Architecture - Nithiyapriya Pasav...Modes of transfer - Computer Organization & Architecture - Nithiyapriya Pasav...
Modes of transfer - Computer Organization & Architecture - Nithiyapriya Pasav...
 
Asynchronous data transfer
Asynchronous data transferAsynchronous data transfer
Asynchronous data transfer
 
Asp.net state management
Asp.net state managementAsp.net state management
Asp.net state management
 
HTTP REQUEST RESPONSE OBJECT - WEB APPLICATION USING C# LAB
HTTP REQUEST RESPONSE OBJECT - WEB APPLICATION USING C# LABHTTP REQUEST RESPONSE OBJECT - WEB APPLICATION USING C# LAB
HTTP REQUEST RESPONSE OBJECT - WEB APPLICATION USING C# LAB
 
HTML SERVER CONTROL - ASP.NET WITH C#
HTML SERVER CONTROL  - ASP.NET WITH C#HTML SERVER CONTROL  - ASP.NET WITH C#
HTML SERVER CONTROL - ASP.NET WITH C#
 
Android LAb - Creating an android app with Radio button
Android LAb - Creating an android app with Radio buttonAndroid LAb - Creating an android app with Radio button
Android LAb - Creating an android app with Radio button
 
ASP.NET - Life cycle of asp
ASP.NET - Life cycle of aspASP.NET - Life cycle of asp
ASP.NET - Life cycle of asp
 
Web application using c# Lab - Web Configuration file
Web application using c# Lab - Web Configuration fileWeb application using c# Lab - Web Configuration file
Web application using c# Lab - Web Configuration file
 
Creation of simple application using - step by step
Creation of simple application using - step by stepCreation of simple application using - step by step
Creation of simple application using - step by step
 
Adaptation of tcp window
Adaptation of tcp windowAdaptation of tcp window
Adaptation of tcp window
 
Asp.net Overview
Asp.net OverviewAsp.net Overview
Asp.net Overview
 
Key mechanism of mobile ip
Key mechanism of mobile ip Key mechanism of mobile ip
Key mechanism of mobile ip
 
Mobile ip overview
Mobile ip overviewMobile ip overview
Mobile ip overview
 
Features of mobile ip
Features of mobile ipFeatures of mobile ip
Features of mobile ip
 
Creating a Name seperator Custom Control using C#
Creating a Name seperator Custom Control using C#Creating a Name seperator Custom Control using C#
Creating a Name seperator Custom Control using C#
 
How to Create Database component -Enterprise Application Using C# Lab
How to Create Database component -Enterprise Application Using C# Lab  How to Create Database component -Enterprise Application Using C# Lab
How to Create Database component -Enterprise Application Using C# Lab
 
Internet (i mcom)
Internet (i mcom)Internet (i mcom)
Internet (i mcom)
 

Dernier

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 

Dernier (20)

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 

Creating simple component

  • 1. Creating & consuming Simple Component using C# - Nithiyapriya P Page 1 Enterprise Applications using C# : Component A component is a reusable piece of code and is in the form of “DLL”. Once a component is designed , it can be reused from any kind of applications such as console applications, web applications or windows applications. A component is a collection of one or more classes that are compiled together as unit. For example, “System.web.dll ” is a single component that provides the objects found in many of the System.web namespace. End user cannot interact with the DLL directly; user can interact with applications and the applications will interact with the component or dll. By creating component you are actually creating assembly file and it has all the benefits that assembly has. You can edit all the assembly details by right clicking "Class Library Project" and Selecting Properties from popup window Creating Simple Component 1. Start visual studio 2012 2. File -> new Project-> Visual C# -> Class Library. Select the location where you wants to save your project & and name it.
  • 2. Creating & consuming Simple Component using C# - Nithiyapriya P Page 2 3. Rename the class1.cs as Calculate.cs and add coding for add, sub, mul, div methods as given below. Calculator.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Calculator { public class Calculate { public int Add(int a, int b) { return a + b; } public int Sub(int a, int b) {
  • 3. Creating & consuming Simple Component using C# - Nithiyapriya P Page 3 return a - b; } public int Mul(int a, int b) { return a * b; } public int Div(int a, int b) { return a / b; } } } 4. Save & build Calculator 5. Now we have created calculator.dll. (you can verify it in your bindebug directory of your class library project) 6. Goto solution explorer, Right click ; Add - > new Project-> visual c#->windows form Application: Give a name and click ok. 7. Design your form for arithmetic calculation as given in form design. 8. Goto solution explorer. Right click on Windows form application- >Add Reference - > browse for the calculate.dll file; check it and add to your project.
  • 4. Creating & consuming Simple Component using C# - Nithiyapriya P Page 4 9. Now you can see “Calculator” under the references folder. 10. Add “using calculator” namespace on form1.cs and add the following code as given below. Form1.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Calculator; namespace Minicalculator { public partial class Form1 : Form { public Form1() { InitializeComponent(); } Calculate cal = new Calculate(); private void Form1_Load(object sender, EventArgs e) { } private void Add_Click(object sender, EventArgs e) { int i = cal.Add(int.Parse(Txt1stNo.Text), int.Parse(Txt2ndNo.Text)); TxtResult.Text = i.ToString();
  • 5. Creating & consuming Simple Component using C# - Nithiyapriya P Page 5 } private void Sub_Click(object sender, EventArgs e) { int i = cal.Sub(int.Parse(Txt1stNo.Text), int.Parse(Txt2ndNo.Text)); TxtResult.Text = i.ToString(); } private void Mul_Click(object sender, EventArgs e) { int i = cal.Mul (int.Parse(Txt1stNo.Text), int.Parse(Txt2ndNo.Text)); TxtResult.Text = i.ToString(); } private void Div_Click(object sender, EventArgs e) { int i = cal.Div (int.Parse(Txt1stNo.Text), int.Parse(Txt2ndNo.Text)); TxtResult.Text = i.ToString(); } private void button1_Click_1(object sender, EventArgs e) { this.Close(); } } } 11. Save the project 12. Right click on the current project and select “set as startup project” and run the project.