-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEasyForm.cs
More file actions
88 lines (72 loc) · 1.96 KB
/
EasyForm.cs
File metadata and controls
88 lines (72 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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 TESTUI.Question;
namespace WinFormsApp1
{
public partial class EasyForm : UserControl
{
List<TestItem> items = new List<TestItem>();
int num = 1;
public EasyForm()
{
InitializeComponent();
createQuestion();
askQuestion(num);
}
private void questionDisp(object sender, EventArgs e)
{
}
public void askQuestion(int num)
{
switch (num)
{
case 1:
label1.Text = items[0].Question;
break;
case 2:
label1.Text = items[1].Question;
break;
}
}
private void createQuestion()
{
string[] q = new string[2];
string[] a = new string[2];
TestItem[] item = new TestItem[2];
q[0] = "1 + 1 = ?";
q[1] = "1 + 2 = ?";
a[0] = "2";
a[1] = "3";
items.Add(item[0] = new TestItem(q[0], a[0]));
items.Add(item[1] = new TestItem(q[1], a[1]));
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void submit(object sender, EventArgs e)
{
string ans = userAnswer.Text.ToString();
if (items[num - 1].CorrectAnswer == ans)
{
num++;
//MessageBox.Show("Correct!!");
askQuestion(num);
}
else
MessageBox.Show("Wrong!!");
}
private void nextButton(object sender, EventArgs e)
{
}
private void prevButton(object sender, EventArgs e)
{
}
}
}