You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ide/step-1-create-a-project-and-add-labels-to-your-form.md
+9-6Lines changed: 9 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,13 @@
1
1
---
2
2
title: "Step 1: Create a project and add labels to your form"
3
3
ms.date: 05/31/2019
4
-
ms.topic: conceptual
4
+
ms.topic: tutorial
5
5
ms.prod: visual-studio-windows
6
6
ms.technology: vs-ide-general
7
7
ms.assetid: f44e50be-a5f5-4d77-9cff-dd52374c3f74
8
+
ms.devlang:
9
+
- "csharp"
10
+
- "vb"
8
11
author: TerryGLee
9
12
ms.author: tglee
10
13
manager: jillfra
@@ -16,7 +19,7 @@ ms.workload:
16
19
As the first steps in developing this quiz, you create the project, and you add labels, a button, and other controls to a form. You also set properties for each control that you add. The project will contain the form, the controls, and (later in the tutorial) code. The button starts the quiz, the labels show the quiz problems, and the other controls show the quiz answers and the time that remains to finish the quiz.
17
20
18
21
> [!NOTE]
19
-
> This topic is part of a tutorial series about basic coding concepts. For an overview of the tutorial, see [Tutorial 2: Create a timed math quiz](../ide/tutorial-2-create-a-timed-math-quiz.md).
22
+
> This topic is part of a tutorial series about basic coding concepts. <br><li>For an overview of the tutorial, see [Tutorial 2: Create a timed math quiz](../ide/tutorial-2-create-a-timed-math-quiz.md). <br><li>To download a completed version of the code, see [Complete math quiz tutorial sample](https://code.msdn.microsoft.com/Complete-Math-Quiz-8581813c).
20
23
21
24
## To create a project for a form
22
25
@@ -96,7 +99,7 @@ As the first steps in developing this quiz, you create the project, and you add
96
99
97
100
7. Choose the plus sign (**+**) next to the **Font** property, and then change the value of the **Size** property to **15.75**.
98
101
99
-
You can change several font properties, as the following picture shows.
102
+
You can change several font properties, as the following screenshot shows.
100
103
101
104

102
105
@@ -144,7 +147,7 @@ As the first steps in developing this quiz, you create the project, and you add
144
147
145
148
16. Change the value of the **(Name)** property for the NumericUpDown control to **sum**.
146
149
147
-
You've created the first row, as the following picture shows.
150
+
You've created the first row, as shown in the following illustration.
148
151
149
152

150
153
@@ -194,14 +197,14 @@ As the first steps in developing this quiz, you create the project, and you add
194
197
195
198
7. Set the value of the **TabIndex** property for the NumericUpDown sum control to **2**, for the difference control to **3**, for the product control to **4**, and for the quotient control to **5**.
196
199
197
-
The form should look like the following illustration.
200
+
The form should look similar to the following screenshot.
198
201
199
202

200
203
201
204
8. To verify whether the **TabIndex** property works as you expect, save and run your program by choosing the **F5** key, or by choosing **Debug** > **Start Debugging** on the menu bar, and then choose the **Tab** key a few times.
202
205
203
206
## To continue or review
204
207
205
-
- To go to the next tutorial step, see [Step 2: Create a random addition problem](../ide/step-2-create-a-random-addition-problem.md).
208
+
- To go to the next tutorial step, see **[Step 2: Create a random addition problem](../ide/step-2-create-a-random-addition-problem.md)**.
206
209
207
210
- To return to the overview topic, see [Tutorial 2: Create a timed math quiz](../ide/tutorial-2-create-a-timed-math-quiz.md).
Copy file name to clipboardExpand all lines: docs/ide/step-2-create-a-random-addition-problem.md
+17-9Lines changed: 17 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,13 @@
1
1
---
2
2
title: "Step 2: Create a random addition problem"
3
3
ms.date: 11/04/2016
4
-
ms.topic: conceptual
5
-
dev_langs:
4
+
ms.topic: tutorial
5
+
ms.prod: visual-studio-windows
6
+
ms.technology: vs-ide-general
7
+
ms.devlang:
8
+
- "csharp"
9
+
- "vb"
10
+
dev_langs:
6
11
- "csharp"
7
12
- "vb"
8
13
ms.assetid: 6461c4cf-f2aa-4bf5-91ed-06820a4f893d
@@ -16,7 +21,7 @@ ms.workload:
16
21
In the second part of this tutorial, you make the quiz challenging by adding math problems that are based on random numbers. You also create a method that's named `StartTheQuiz()` and that fills in the problems and starts the countdown timer. Later in this tutorial, you'll add the subtraction, multiplication, and division problems.
17
22
18
23
> [!NOTE]
19
-
> This topic is part of a tutorial series about basic coding concepts. For an overview of the tutorial, see [Tutorial 2: Create a timed math quiz](../ide/tutorial-2-create-a-timed-math-quiz.md).
24
+
> This topic is part of a tutorial series about basic coding concepts. <br><li>For an overview of the tutorial, see [Tutorial 2: Create a timed math quiz](../ide/tutorial-2-create-a-timed-math-quiz.md). <br><li>To download a completed version of the code, see [Complete math quiz tutorial sample](https://code.msdn.microsoft.com/Complete-Math-Quiz-8581813c).
20
25
21
26
## To create a random addition problem
22
27
@@ -31,6 +36,9 @@ In the second part of this tutorial, you make the quiz challenging by adding mat
> Use the programming language control at the top right of this page to view either the C# code snippet or the Visual Basic code snippet.<br><br>
41
+
34
42
You've added a Random object to your form and named the object **randomizer**.
35
43
36
44
`Random` is known as an object. You've probably heard that word before, and you learn more about what it means for programming in the next tutorial. For now, just remember that you can use `new` statements to create buttons, labels, panels, OpenFileDialogs, ColorDialogs, SoundPlayers, Randoms, and even forms, and those items are referred to as objects. When you run your program, the form is started, and the code behind it creates a random object and names it **randomizer**.
@@ -54,8 +62,8 @@ In the second part of this tutorial, you make the quiz challenging by adding mat
54
62
55
63
Notice that when you enter the dot (.) after `randomizer` in the code, an IntelliSense window opens and shows you all of the Random object's methods that you can call. For example, IntelliSense lists the `Next()` method, as follows.
In the next step of the tutorial, you'll add the sum.
91
99
92
100
## To continue or review
93
101
94
-
- To go to the next tutorial step, see [Step 3: Add a countdown timer](../ide/step-3-add-a-countdown-timer.md).
102
+
- To go to the next tutorial step, see **[Step 3: Add a countdown timer](../ide/step-3-add-a-countdown-timer.md)**.
95
103
96
104
- To return to the previous tutorial step, see [Step 1: Create a project and add labels to your form](../ide/step-1-create-a-project-and-add-labels-to-your-form.md).
Copy file name to clipboardExpand all lines: docs/ide/step-3-add-a-countdown-timer.md
+15-7Lines changed: 15 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,13 @@
1
1
---
2
2
title: "Step 3: Add a countdown timer"
3
3
ms.date: 11/04/2016
4
-
ms.topic: conceptual
5
-
dev_langs:
4
+
ms.topic: tutorial
5
+
ms.prod: visual-studio-windows
6
+
ms.technology: vs-ide-general
7
+
ms.devlang:
8
+
- "csharp"
9
+
- "vb"
10
+
dev_langs:
6
11
- "csharp"
7
12
- "vb"
8
13
ms.assetid: 62670a2b-efdc-45c6-9646-9b17eeb33dcb
@@ -16,7 +21,7 @@ ms.workload:
16
21
In the third part of this tutorial, you'll add a countdown timer to track the number of seconds that remain for the quiz taker to finish.
17
22
18
23
> [!NOTE]
19
-
> This topic is part of a tutorial series about basic coding concepts. For an overview of the tutorial, see [Tutorial 2: Create a timed math quiz](../ide/tutorial-2-create-a-timed-math-quiz.md).
24
+
> This topic is part of a tutorial series about basic coding concepts. <br><li>For an overview of the tutorial, see [Tutorial 2: Create a timed math quiz](../ide/tutorial-2-create-a-timed-math-quiz.md). <br><li>To download a completed version of the code, see [Complete math quiz tutorial sample](https://code.msdn.microsoft.com/Complete-Math-Quiz-8581813c).
20
25
21
26
## To add a countdown timer
22
27
@@ -25,6 +30,9 @@ In the third part of this tutorial, you'll add a countdown timer to track the nu
> Use the programming language control at the top right of this page to view either the C# code snippet or the Visual Basic code snippet.<br><br>
35
+
28
36
Now you need a method that actually counts the seconds, such as a timer, which raises an event after the amount of time that you specify.
29
37
30
38
2. In the design window, move a <xref:System.Windows.Forms.Timer> control from the **Components** category of the **Toolbox** to your form.
@@ -51,7 +59,7 @@ In the third part of this tutorial, you'll add a countdown timer to track the nu
51
59
You just added an `if else` statement, which is how you tell programs to make decisions. An `if else` statement looks like the following.
52
60
53
61
> [!NOTE]
54
-
> The following example is for illustration only-don't add it to your project.
62
+
> The following example is for demonstration only--don't add it to your project.
55
63
56
64
```vb
57
65
If(somethingthatyourprogramwillcheck)Then
@@ -96,11 +104,11 @@ In the third part of this tutorial, you'll add a countdown timer to track the nu
Copy file name to clipboardExpand all lines: docs/ide/step-4-add-the-checktheanswer-parens-method.md
+15-4Lines changed: 15 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,13 @@
1
1
---
2
2
title: "Step 4: Add the CheckTheAnswer() method"
3
3
ms.date: 11/04/2016
4
-
ms.topic: conceptual
5
-
dev_langs:
4
+
ms.topic: tutorial
5
+
ms.prod: visual-studio-windows
6
+
ms.technology: vs-ide-general
7
+
ms.devlang:
8
+
- "csharp"
9
+
- "vb"
10
+
dev_langs:
6
11
- "csharp"
7
12
- "vb"
8
13
ms.assetid: c66f3831-b4a0-40bc-a109-8f46f4db35ed
@@ -16,17 +21,23 @@ ms.workload:
16
21
In the fourth part of this tutorial, you'll write a method, `CheckTheAnswer()`, that determines whether the answers to the math problems are correct. This topic is part of a tutorial series about basic coding concepts. For an overview of the tutorial, see [Tutorial 2: Create a timed math quiz](../ide/tutorial-2-create-a-timed-math-quiz.md).
17
22
18
23
> [!NOTE]
19
-
> If you're following along in Visual Basic, you'll use the `Function` keyword instead of the usual `Sub` keyword because this method returns a value. It's really that simple: a sub doesn't return a value, but a function does.
24
+
> This topic is part of a tutorial series about basic coding concepts. <br><li>For an overview of the tutorial, see [Tutorial 2: Create a timed math quiz](../ide/tutorial-2-create-a-timed-math-quiz.md). <br><li>To download a completed version of the code, see [Complete math quiz tutorial sample](https://code.msdn.microsoft.com/Complete-Math-Quiz-8581813c).
20
25
21
26
## To verify whether the answers are correct
22
27
28
+
> [!NOTE]
29
+
> If you're following along in Visual Basic, you'll use the `Function` keyword instead of the usual `Sub` keyword because this method returns a value. It's really that simple: a sub doesn't return a value, but a function does.
30
+
23
31
1. Add the `CheckTheAnswer()` method.
24
32
25
33
When this method is called, it adds the values of addend1 and addend2 and compares the result to the value in the sum <xref:System.Windows.Forms.NumericUpDown> control. If the values are equal, the method returns a value of `true`. Otherwise, the method returns a value of `false`. Your code should look like the following.
> Use the programming language control at the top right of this page to view either the C# code snippet or the Visual Basic code snippet.<br><br>
40
+
30
41
Next, you'll check the answer by updating the code in the method for the timer's <xref:System.Windows.Forms.Timer.Tick> event handler to call the new `CheckTheAnswer()` method.
31
42
32
43
2. Add the following code to the `if else` statement.
@@ -45,6 +56,6 @@ In the fourth part of this tutorial, you'll write a method, `CheckTheAnswer()`,
45
56
46
57
## To continue or review
47
58
48
-
- To go to the next tutorial step, see [Step 5: Add Enter event handlers for the NumericUpDown controls](../ide/step-5-add-enter-event-handlers-for-the-numericupdown-controls.md).
59
+
- To go to the next tutorial step, see **[Step 5: Add Enter event handlers for the NumericUpDown controls](../ide/step-5-add-enter-event-handlers-for-the-numericupdown-controls.md)**.
49
60
50
61
- To return to the previous tutorial step, see [Step 3: Add a countdown timer](../ide/step-3-add-a-countdown-timer.md).
Copy file name to clipboardExpand all lines: docs/ide/step-5-add-enter-event-handlers-for-the-numericupdown-controls.md
+14-3Lines changed: 14 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,15 @@
1
1
---
2
2
title: "Step 5: Add Enter event handlers for NumericUpDown controls"
3
3
ms.date: 11/04/2016
4
-
ms.topic: conceptual
4
+
ms.topic: tutorial
5
+
ms.prod: visual-studio-windows
6
+
ms.technology: vs-ide-general
7
+
ms.devlang:
8
+
- "csharp"
9
+
- "vb"
10
+
dev_langs:
11
+
- "csharp"
12
+
- "vb"
5
13
ms.assetid: 45a99a5d-c881-4298-b74d-adb481dec5ee
6
14
author: TerryGLee
7
15
ms.author: tglee
@@ -17,7 +25,7 @@ ms.workload:
17
25
In the fifth part of this tutorial, you'll add <xref:System.Windows.Forms.Control.Enter> event handlers to make entering answers for quiz problems a little easier. This code will select and clear the current value in each <xref:System.Windows.Forms.NumericUpDown> control as soon as the quiz taker chooses it and starts to enter a different value.
18
26
19
27
> [!NOTE]
20
-
> This topic is part of a tutorial series about basic coding concepts. For an overview of the tutorial, see [Tutorial 2: Create a timed math quiz](../ide/tutorial-2-create-a-timed-math-quiz.md).
28
+
> This topic is part of a tutorial series about basic coding concepts. <br><li>For an overview of the tutorial, see [Tutorial 2: Create a timed math quiz](../ide/tutorial-2-create-a-timed-math-quiz.md). <br><li>To download a completed version of the code, see [Complete math quiz tutorial sample](https://code.msdn.microsoft.com/Complete-Math-Quiz-8581813c).
21
29
22
30
## To verify the default behavior
23
31
@@ -52,6 +60,9 @@ In the fifth part of this tutorial, you'll add <xref:System.Windows.Forms.Contro
> Use the programming language control at the top right of this page to view either the C# code snippet or the Visual Basic code snippet.<br><br>
65
+
55
66
This code may look complex, but you can understand it if you look at it step by step. First, look at the top of the method: `object sender` in C# or `sender As System.Object` in Visual Basic. This parameter refers to the object whose event is firing, which is known as the sender. In this case, the sender object is the NumericUpDown control. So, in the first line of the method, you specify that the sender isn't just any generic object but specifically a NumericUpDown control. (Every NumericUpDown control is an object, but not every object is a NumericUpDown control.) The NumericUpDown control is named **answerBox** in this method, because it will be used for all of the NumericUpDown controls on the form, not just the sum NumericUpDown control. Because you declare the answerBox variable in this method, its scope applies only to this method. In other words, the variable can be used only within this method.
56
67
57
68
The next line verifies whether answerBox was successfully converted (cast) from an object to a NumericUpDown control. If the conversion was unsuccessful, the variable would have a value of `null` (C#) or `Nothing` (Visual Basic). The third line gets the length of the answer that appears in the NumericUpDown control, and the fourth line selects the current value in the control based on this length. Now, when the quiz taker chooses the control, Visual Studio fires this event, which causes the current answer to be selected. As soon as the quiz taker starts to enter a different answer, the previous answer is cleared and replaced with the new answer.
@@ -68,6 +79,6 @@ In the fifth part of this tutorial, you'll add <xref:System.Windows.Forms.Contro
68
79
69
80
## To continue or review
70
81
71
-
- To go to the next tutorial step, see [Step 6: Add a subtraction problem](../ide/step-6-add-a-subtraction-problem.md).
82
+
- To go to the next tutorial step, see **[Step 6: Add a subtraction problem](../ide/step-6-add-a-subtraction-problem.md)**.
72
83
73
84
- To return to the previous tutorial step, see [Step 4: Add the CheckTheAnswer() method](../ide/step-4-add-the-checktheanswer-parens-method.md).
0 commit comments