




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































































01 - Sum 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; namespace WindowsFormsApplication { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { double a = Convert.ToInt32(textBox1.Text); double b = Convert.ToInt32(textBox2.Text); textBox3.Text = (a + b).ToString(); } } }
02 - Sub 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; namespace WindowsFormsApplication { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { double a = Convert.ToInt32(textBox1.Text); double b = Convert.ToInt32(textBox2.Text); textBox3.Text = (a - b).ToString(); } } }
04 - Div 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; namespace WindowsFormsApplication { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { double a = Convert.ToInt32(textBox1.Text); double b = Convert.ToInt32(textBox2.Text); textBox3.Text = (a / b).ToString(); } } }
05 - Biggest Number 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 System.Data.SqlClient; namespace WindowsFormsApplication { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { int a = Convert.ToInt32(textBox1.Text); int b = Convert.ToInt32(textBox2.Text); if (a>b) { textBox3.Text = "Number 1 is a Biggest number"; } else { textBox3.Text = "Number 2 is a Biggest number"; } } } }
07 - Picture Box 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; namespace WindowsFormsApplication { public partial class Form2 : Form { public Form2() { InitializeComponent(); } string imgLog = ""; private void pictureBox1_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "Image Files(Image Files(.jpg;.jpeg;.gif;.bmp;.tif;.tiff;.pdf)| .jpg;.jpeg;.gif;.bmp;.tif;.tiff;.pdf"; if (dlg.ShowDialog() == DialogResult.OK) { imgLog = dlg.FileName.ToString(); pictureBox1.ImageLocation = imgLog; } } } }
08 - Age Calculater 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; namespace WindowsFormsApplication { public partial class Form5 : Form { public Form5() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { string IDNumber = textBox1.Text; int y, m, d; int a, b, c; y = Convert.ToInt32(IDNumber.Substring(0, 2)); a = (1900 + y); m = Convert.ToInt32(IDNumber.Substring(2, 3)); if (m < 500) { b = ((m ) / 30);
09 - Multiplication - List Box 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; namespace WindowsFormsApplication { public partial class Form6 : Form { public Form6() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { int a = Convert.ToInt32(textBox1.Text); int b = Convert.ToInt32(textBox2.Text); for (int i = 1; i <= a; i++) { listBox1.Items.Add("" + i + " * " + b + " = " + (i * b).ToString()); } } private void button2_Click(object sender, EventArgs e) { textBox1.Text = ""; textBox2.Text = ""; listBox1.Items.Clear(); } } }
10 - BMI Calculator 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; namespace WindowsFormsApplication { public partial class Form7 : Form { public Form7() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { double h = Convert.ToInt32(textBox1.Text); double w = Convert.ToInt32(textBox2.Text); textBox3.Text = (w / ((h/100) *( h/100))).ToString(); double bmi = Convert.ToDouble(textBox3.Text); if (bmi < 16) { MessageBox.Show("Severe Thinness"); } else if (bmi < 17) { MessageBox.Show("Moderate Thinness"); } else if (bmi< 18.5) { MessageBox.Show("Milled Thinness"); } else if (bmi < 25)
11 - Temperature 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; namespace WindowsFormsApplication { public partial class Form8 : Form { public Form8() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { double c = Convert.ToDouble(textBox1.Text); if (radioButton1.Checked) { textBox2.Text = (c + 273).ToString(); } else { textBox2.Text = (c* 9 / 5 + 32).ToString() ; } } } }
12 - Bank Balance Sheet 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; namespace WindowsFormsApplication { public partial class Form9 : Form { public Form9() { InitializeComponent(); } int c; private void button1_Click(object sender, EventArgs e) { richTextBox1.SelectedText = Environment.NewLine + "Account" + textBox1.Text + " created, Initial balance" + textBox2.Text; richTextBox1.SelectionColor = Color.Black; c = Convert.ToInt32(textBox2.Text); } private void button2_Click(object sender, EventArgs e) { int b = Convert.ToInt32(textBox4.Text); if (textBox1.Text == textBox3.Text) { c = c - b; }
13 - Text File 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; namespace WindowsFormsApplication { public partial class Form10 : Form { public Form10() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { string filepath = @"C:\Users\NEXT GEN\Desktop" + "\New folder\"
14 - Timer 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; namespace WindowsFormsApplication { public partial class Form11 : Form { public Form11() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { timer1.Start(); } int mm = 0; int ss = 0; int mi = 0; private void timer1_Tick(object sender, EventArgs e) {mm++; if (mm > 59) { mm = 0; ss++; } if (ss > 59) { ss = 0; mi++; }