Question: I am creating a Math Quiz project for primary school children iwith Visual Studio 2017, in C#. I need to add a countdown timer to

I am creating a Math Quiz project for primary school children iwith Visual Studio 2017, in C#. I need to add a countdown timer to my C# code below. I have tried to. I have created seperate games. Addition, subtraction, multiplication and division. I am new to C#. Can you help me with a timer coding in C# for my addition program below, that will work in all my other programs.

Thanks.

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 AssignmentQuiz { public partial class Form5 : Form { public Form5() { InitializeComponent(); } int num1, num2, num3, num4, num5, num6;

private void button3_Click(object sender, EventArgs e) { Form1 newForm = new Form1(); newForm.Show(); this.Hide(); }

private void button2_Click(object sender, EventArgs e) { int answer1 = Convert.ToInt32(textBox1.Text); int answer2 = Convert.ToInt32(textBox2.Text); int answer3 = Convert.ToInt32(textBox3.Text);

if ((((num1 + num2) == answer1) && ((num3 + num4) == answer2) && ((num5 + num6 == answer3)))) { MessageBox.Show("WELL DONE");

Form6 newForm = new Form6(); newForm.Show(); this.Hide(); } else { MessageBox.Show("incorrect answer"); } } private void button1_Click(object sender, EventArgs e) { System.Random random = new System.Random();

num1 = random.Next(1, 10); label1.Text = num1.ToString();

num2 = random.Next(5); label3.Text = num2.ToString(); num3 = random.Next(1, 15); label5.Text = num3.ToString();

num4 = random.Next(5); label7.Text = num4.ToString();

num5 = random.Next(1, 20); label9.Text = num5.ToString();

num6 = random.Next(5); label11.Text = num6.ToString();

} } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!