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