0% found this document useful (0 votes)
71 views3 pages

Practical No: (11) : Programs To Create and Use DLL: Compute - Cs

This document discusses creating and using a DLL. It contains code for a Compute.cs class library that defines addition and subtraction methods. It also contains code for a Windows forms application that references the Compute DLL, allows the user to enter two numbers, calls the addition or subtraction method based on a button click, and displays the result. The output shows a simple GUI with textboxes for two numbers, addition and subtraction buttons, and a textbox to display the result.

Uploaded by

sushil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views3 pages

Practical No: (11) : Programs To Create and Use DLL: Compute - Cs

This document discusses creating and using a DLL. It contains code for a Compute.cs class library that defines addition and subtraction methods. It also contains code for a Windows forms application that references the Compute DLL, allows the user to enter two numbers, calls the addition or subtraction method based on a button click, and displays the result. The output shows a simple GUI with textboxes for two numbers, addition and subtraction buttons, and a textbox to display the result.

Uploaded by

sushil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

T.Y.B.SC. (I.T.) - ASP.

NETWITHC#
IT-7239
2018-2019

Practical No: [11]: Programs to create and use DLL

GUI:-

Source Code: - CS Code

Compute.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Computation
{
public class compute
{
public int add(int a, int b)
{
return a + b;
}
public int sub(int a, int b)
{
return a - b;
}
}
}

Webform1.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 Computation;

Page 1
T.Y.B.SC. (I.T.) - ASP.NETWITHC#
IT-7239
2018-2019

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
compute cal = new compute();
private void Form1_Load(object sender, EventArgs e)
{

}
private void button1_Click(object sender, EventArgs e)
{
try
{
int i = cal.add(int.Parse(textBox1.Text), int.Parse(textBox2.Text));
textBox3.Text = i.ToString();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void button2_Click(object sender, EventArgs e)


{
try
{
int i = cal.sub(int.Parse(textBox1.Text), int.Parse(textBox2.Text));
textBox3.Text = i.ToString();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}

Output:-

Page 2
T.Y.B.SC. (I.T.) - ASP.NETWITHC#
IT-7239
2018-2019

Page 3

You might also like