Docsity

Windows Forms Application - Utility Tools, Exercises of Information and Communications Technology (ICT)

Toggle sidebar
bg1
private void button1_Click(object sender, EventArgs e)
{
int a = Convert.ToInt32(textBox1.Text);
int b = Convert.ToInt32(textBox2.Text);
if (radioButton1.Checked)
{
textBox3.Text = (a + b).ToString();
}
else if (radioButton2.Checked)
{
textBox3.Text = (a - b).ToString();
}
else if (radioButton3.Checked)
{
textBox3.Text = (a * b).ToString();
}
else if (radioButton4.Checked)
{
textBox3.Text = (a / b).ToString();
}
else if (radioButton5.Checked)
{
textBox3.Text = (a ^ b).ToString();
}
else
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27

Partial preview of the text

Download Windows Forms Application - Utility Tools and more Exercises Information and Communications Technology (ICT) in PDF only on Docsity!

private void button1_Click(object sender, EventArgs e)

int a = Convert.ToInt32(textBox1.Text);

int b = Convert.ToInt32(textBox2.Text);

if (radioButton1.Checked)

textBox3.Text = (a + b).ToString();

else if (radioButton2.Checked)

textBox3.Text = (a - b).ToString();

else if (radioButton3.Checked)

textBox3.Text = (a * b).ToString();

else if (radioButton4.Checked)

textBox3.Text = (a / b).ToString();

else if (radioButton5.Checked)

textBox3.Text = (a ^ b).ToString();

else

textBox3.Text = (a % b).ToString();

private void button2_Click(object sender, EventArgs e)

textBox1.Text = "";

textBox2.Text = "";

textBox3.Text = "";

Biggest Number

private void button3_Click(object sender, EventArgs e)

int num1 = Convert.ToInt32(textBox4.Text);

int num2 = Convert.ToInt32(textBox5.Text);

int num3 = Convert.ToInt32(textBox6.Text);

if ((num1 > num2) && (num1 > num3))

MessageBox.Show (" Biggest Number "+num1);

listBox1.Items.Clear();

private void button9_Click(object sender, EventArgs e)

double c = Convert.ToDouble(textBox17.Text);

if (radioButton7.Checked)

textBox18.Text = (c + 273).ToString();

else

textBox18.Text = (c* 9 / 5 + 32).ToString }

private void button21_Click(object sender, EventArgs e)

double h = Convert.ToInt32(textBox37.Text);

double w = Convert.ToInt32(textBox38.Text);

textBox39.Text = (w / ((h/100) *( h/100))).ToString();

double bmi = Convert.ToDouble(textBox39.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)

MessageBox.Show("Normal");

else if (bmi < 30)

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

namespace WindowsFormsApplication

public partial class Form3 : Form

public Form3()

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)/ 30);

else

b = (((m - 500)+30) / 30);

d = Convert.ToInt32(IDNumber.Substring(2, 3));

if (d < 500)

c = m % 30;

else

c = (m - 500) % 30;

string x = ""+a+" / "+b+" /"+c+"" ;

textBox2.Text = x.ToString();

textBox3.Text =( DateTime.Now.Year - (a)).ToString();

if (m < 500)

textBox4.Text = "Male";

else

textBox4.Text = "Female";

private void button4_Click(object sender, EventArgs e) { int b = Convert.ToInt32(textBox8.Text); if (textBox5.Text == textBox7.Text) { c = c + b; } else { MessageBox.Show("Invalid Account Number"); } richTextBox1.SelectedText= Environment.NewLine +"Account " + textBox5.Text + ",Deposite" + textBox8.Text + "$"+ ", balance" + c.ToString() +"$"; richTextBox1.SelectionColor = Color.Blue; } private void Form3_Load(object sender, EventArgs e) { textBox25.Enabled = false; textBox26.Enabled = false; comboBox2.Enabled = false; //comboBox3.Enabled = false; comboBox4.Enabled = false; radioButton3.Enabled = false; radioButton4.Enabled = false; comboBox2.Items.Add("Bus"); comboBox2.Items.Add("Lorry"); comboBox2.Items.Add("Van"); comboBox2.Items.Add("Car"); comboBox2.Items.Add("Motor cycle"); for (int i = 1970; i <= 2010; i++) { comboBox3.Items.Add(i.ToString()); }

comboBox4.Items.Add("Misubishi"); comboBox4.Items.Add("Toyota"); comboBox4.Items.Add("Zuzuki"); comboBox4.Items.Add("Honda"); comboBox4.Items.Add("TVS"); comboBox4.Items.Add("Bajaj"); } private void button31_Click(object sender, EventArgs e) { string c = textBox25.Text; //string a = comboBox2.Text; if(comboBox2.SelectedItem == "Bus") { textBox26.Text = 2500.ToString(); } else if (comboBox2.SelectedItem == "Lorry") { textBox26.Text = 2500.ToString(); } else if (comboBox2.SelectedItem == "Van") { textBox26.Text = 1500.ToString(); } else if (comboBox2.SelectedItem == "Car") { textBox26.Text = 1750.ToString(); } else if (comboBox2.SelectedItem == "Motor cycle") { textBox26.Text = 400.ToString(); } int a = Convert.ToInt32(textBox26.Text); if (radioButton1.Checked) { textBox26.Text = (a +0).ToString(); } else { textBox26.Text =( a + 5000).ToString();

GreenLight.Visible = true; } else if (GreenLight.Visible == true) { RedLight.Visible = false; YellowLight.Visible = true; GreenLight.Visible = false; } else if (YellowLight.Visible == true) { RedLight.Visible = true; YellowLight.Visible = false; GreenLight.Visible = false; } } private void button1_Click(object sender, EventArgs e) { timer1.Enabled = true; } private void button2_Click(object sender, EventArgs e) { timer1.Enabled = false; } } } Text File private void button1_Click(object sender, EventArgs e) { string filepath =@"C:\Users\NEXT GEN\Desktop"+"\New folder\"+textBox1.Text+".txt"; StreamWriter writer =new StreamWriter(filepath); using (writer)

writer.WriteLine("Letter :" + textBox1.Text); }

Telephone Charge private void button1_Click(object sender, EventArgs e) { int c = Convert.ToInt32(textBox1.Text); int d = Convert.ToInt32(textBox2.Text); if (radioButton1.Checked) {

private void Form1_Load(object sender, EventArgs e) { comboBox1.Items.Add(10); comboBox1.Items.Add(20);

comboBox1.Items.Add(30); } private void button1_Click(object sender, EventArgs e) { int q = Convert.ToInt32(textBox1.Text); int d = Convert.ToInt32(comboBox1.Text); if (radioButton1.Checked) { textBox2.Text= 750.ToString(); } else if (radioButton2.Checked) { textBox2.Text = 1500.ToString(); } else if (radioButton3.Checked) { textBox2.Text= 2000.ToString(); } int u = Convert.ToInt32(textBox2.Text); textBox3.Text =(( u * q * d) / 100).ToString(); textBox4.Text =( (q * u) - ((u * q * d) / 100)).ToString(); }

Salary System

else if (listBox1.SelectedItem.ToString() == "Year end Bounes")

r = 30000;

else if (listBox1.SelectedItem.ToString() == "Performance Bonus")

r = 25000;

else if (listBox1.SelectedItem.ToString() == "Customer Bounes")

r = 15000;

w = r;

textBox2.Text = ((x + y + w) - p).ToString();

Sandwich maker

private void button1_Click(object sender, EventArgs e)

listBox1.Items.Add("sandwich order");

if (radioButton1.Checked == true)

listBox1.Items.Add("White bread");

else {

listBox1.Items.Remove("White bread");

if (radioButton2.Checked == true)

listBox1.Items.Add("Wheat bread");

else

listBox1.Items.Remove("Wheate bread");

if (radioButton3.Checked == true)

listBox1.Items.Add("Rye bread");

else

listBox1.Items.Remove("Rye bread");

if (radioButton4.Checked == true)

listBox1.Items.Add("None Cheese");

else

listBox1.Items.Remove("None Cheese");