Faculty of Information Technology Assignment1 Lecturer Module : Ms. Reem Qaqa : Visual Programming (Counter Application) Your counter application will consist of a Label and Button on the Form. The Label initially displays 0, but, each time a user clicks the Button, the value in the Label is increased by 1. When incrementing the Label: private void button1_Click(object sender, EventArgs e) { label1.Text =Convert.ToString( Convert.ToInt16(label1.Text) + 1); } Faculty of Information Technology Assignment2 Lecturer Module : Ms. Reem Qaqa : Visual Programming (Account Information Application) Create an application that allows a user to input a name, account number and deposit amount. The user then clicks the Enter Button, which causes the name and account number to be copied and displayed in two output Labels. The deposit amount entered will be added to the deposit amount displayed in another output Label. The result is displayed in the same output Label. Every time the Enter Button is clicked, the deposit amount entered is added to the deposit amount displayed in the output Label, keeping a cumulative total. private void button1_Click(object sender, EventArgs e) { label1.Text = textBox1.Text; label2.Text = textBox2.Text; label3.Text = textBox3.Text; } Faculty of Information Technology Assignment3 Lecturer Module : Ms. Reem Qaqa : Visual Programming After entering 10 in the textBox1 and 1.05 in the textBox2, a user clicks the Button and the total cost will be shown in the label . private void button1_Click(object sender, EventArgs e) { label1.Text = Convert.ToString(Convert.ToDouble(textBox1.Text) * Convert.ToDouble(textBox2.Text)); } Faculty of Information Technology Assignment 4 Lecturer Module : Ms. Reem Qaqa : Visual Programming (Account Information Enhancement) Create an application that asks the user for a withdrawal or deposit amount. The user can enter both a withdrawal and deposit amount at the same time. When the Enter Button is clicked, the balance is updated appropriately private void button1_Click(object sender, EventArgs e) { label3.Text = Convert.ToString(Convert.ToDouble(textBox2.Text) - Convert.ToDouble(textBox1.Text)); } Faculty of Information Technology Assignment 5 Lecturer Module : Ms. Reem Qaqa : Visual Programming Create the following application and write the suitable code in the buttons. private void button1_Click(object sender, EventArgs e) { textBox3.Text = textBox1.Text + " " + textBox2.Text; } private void button2_Click(object sender, EventArgs e) { textBox3.Text = textBox1.Text + " " + textBox2.Text; textBox1.Text = " "; textBox2.Text = " "; } Faculty of Information Technology Assignment 6 Lecturer : Ms. Reem Qaqa Module : Visual Programming Create the following application : - Write a code to show the user suitable messages ( passwords match or not) when he/she clicks on the confirm button. private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == "" || textBox2.Text == "") MessageBox.Show("You must enter a password"); else if (textBox1.Text != textBox2.Text) MessageBox.Show("Password doesn't match"); else if (textBox1.Text == textBox2.Text) MessageBox.Show(" Your password is correct"); } Faculty of Information Technology Assignment 7 Assignment 7 Lecturer Module : Ms. Reem Qaqa : Visual Programming - Create the following application and write the suitable code . private void button4_Click(object sender, EventArgs e) { groupBox1.Text = textBox1.Text; } private void button1_Click(object sender, EventArgs e) { panel1.BorderStyle = BorderStyle.None; } private void button2_Click(object sender, EventArgs e) { panel1.BorderStyle = BorderStyle.FixedSingle; } private void button3_Click(object sender, EventArgs e) { panel1.BorderStyle = BorderStyle.Fixed3D; } Faculty of Information Technology Assignment 8 Lecturer Module : Ms. Reem Qaqa : Visual Programming - Create the following application and write the suitable code . private void checkBox1_CheckedChanged(object sender, EventArgs e) { textBox1.Visible = checkBox1.Checked; } private void checkBox3_CheckedChanged(object sender, EventArgs e) { textBox1.Multiline = checkBox3.Checked; } private void checkBox2_CheckedChanged(object sender, EventArgs e) { textBox1.Enabled = checkBox2.Checked; } private void checkBox4_CheckedChanged(object sender, EventArgs e) { textBox1.ReadOnly = checkBox4.Checked; } Faculty of Information Technology Assignment 9 Lecturer Module : Ms. Reem Qaqa : Visual Programming - Create the following application and write the suitable code so that each radio button shows it’s corresponding panel and hides the other panels. (Put all panels at the same location and give them the same size) Panel private void radioButton1_CheckedChanged(object sender, EventArgs e) { panel1.Visible = radioButton1.Checked; panel2.Visible = radioButton2.Checked; panel3.Visible = radioButton3.Checked; } private void radioButton2_CheckedChanged(object sender, EventArgs e) { panel1.Visible = radioButton1.Checked; panel2.Visible = radioButton2.Checked; panel3.Visible = radioButton3.Checked; } private void radioButton3_CheckedChanged(object sender, EventArgs e) { panel1.Visible = radioButton1.Checked; panel2.Visible = radioButton2.Checked; panel3.Visible = radioButton3.Checked; } Faculty of Information Technology Assignment 8 Assignment 10 Lecturer Module : Ms. Reem Qaqa : Visual Programming Create the following application and write a suitable code to perform the following: - When you click on the ‘next image’ button another image will be shown. (Suppose you want to move between 3 images only) - When you reach the last image and click on the next image button the first image will be shown again. namespace WindowsApplication10 { public partial class Form1 : Form { int i = 0; string[] pics = new string[3] { "Koala", "Penguins", "Jellyfish" }; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { i++; i = i % 3; pictureBox1.Image = Image.FromFile("C:\\Users\\Public\\Pictures\\SamplePictures\\"+pics[i]+".jpg"); } } } Faculty of Information Technology Assignment 8 Assignment 11 Lecturer Module : Ms. Reem Qaqa : Visual Programming Create the following application and write a suitable code to perform the following: - The picture box will be hidden at first. - When you click inside the boundaries of the picturebox it will show otherwise it will be hidden again. - Show the x and Y coordinates in the title bar each time you click the mouse. Hint: take into consideration the picturebox’s size and location. After clicking Make the pictureBox’s visible property false . Picture box boundaries: X: 106 to 198 -> (106+92) Y: 86 to 145 -> (86+59) private void Form1_MouseClick(object sender, MouseEventArgs e) { Text = "X:"+e.X + " Y:" + e.Y; if ((e.X >= 92 && e.X <= 198) && (e.Y >= 59 && e.Y <= 145)) { pictureBox1.Visible = true; } else pictureBox1.Visible = false; } Faculty of Information Technology Assignment 8 Assignment 12 Lecturer Module : Ms. Reem Qaqa : Visual Programming Create the following application and write a suitable code to perform the following: - When you press on the Shift+ r keys: the background color will change to red. When you press on the Ctrl+g keys: the background color will change to green. When you press on the Alt+ b keys: the background color will change to blue. private void Form1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.R && e.Shift) BackColor = Color.Red; else if (e.KeyCode == Keys.G && e.Control) BackColor = Color.Green; else if (e.KeyCode == Keys.B && e.Alt) BackColor = Color.Blue; }