Skip to content

Commit

Permalink
Merge pull request #5602 from TerryGLee/tglee-include
Browse files Browse the repository at this point in the history
replace devlang control text with include file
  • Loading branch information
PRMerger14 authored Oct 14, 2019
2 parents ea7e63e + 13220a3 commit 98b02f8
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ This code adds functionality to the buttons you added earlier. Without this code
## How to write code for additional buttons and a check box

Add the following code to your **Form1** code file (*Form1.cs* or *Form1.vb*).
> [!IMPORTANT]
> 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>![Programming language control for Docs.Microsoft.com](../ide/media/docs-programming-language-control.png)

[!INCLUDE [devlang-control-csharp-vb](./includes/devlang-control-csharp-vb.md)]

[!code-csharp[VbExpressTutorial1Step9_10#2](../ide/codesnippet/CSharp/step-10-write-code-for-additional-buttons-and-a-check-box_1.cs)]

Expand Down
3 changes: 1 addition & 2 deletions docs/ide/step-2-create-a-random-addition-problem.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ In the second part of this tutorial, you make the quiz challenging by adding mat
[!code-csharp[VbExpressTutorial3Step2#1](../ide/codesnippet/CSharp/step-2-create-a-random-addition-problem_1.cs)]
[!code-vb[VbExpressTutorial3Step2#1](../ide/codesnippet/VisualBasic/step-2-create-a-random-addition-problem_1.vb)]

> [!IMPORTANT]
> 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>![Programming language control for Docs.Microsoft.com](../ide/media/docs-programming-language-control.png)
[!INCLUDE [devlang-control-csharp-vb](./includes/devlang-control-csharp-vb.md)]

You've added a Random object to your form and named the object **randomizer**.

Expand Down
3 changes: 1 addition & 2 deletions docs/ide/step-3-add-a-countdown-timer.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ In the third part of this tutorial, you'll add a countdown timer to track the nu
[!code-vb[VbExpressTutorial3Step3#5](../ide/codesnippet/VisualBasic/step-3-add-a-countdown-timer_1.vb)]
[!code-csharp[VbExpressTutorial3Step3#5](../ide/codesnippet/CSharp/step-3-add-a-countdown-timer_1.cs)]

> [!IMPORTANT]
> 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>![Programming language control for Docs.Microsoft.com](../ide/media/docs-programming-language-control.png)
[!INCLUDE [devlang-control-csharp-vb](./includes/devlang-control-csharp-vb.md)]

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.

Expand Down
3 changes: 1 addition & 2 deletions docs/ide/step-4-add-the-checktheanswer-parens-method.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ In the fourth part of this tutorial, you'll write a method, `CheckTheAnswer()`,
[!code-vb[VbExpressTutorial3Step4#8](../ide/codesnippet/VisualBasic/step-4-add-the-checktheanswer-parens-method_1.vb)]
[!code-csharp[VbExpressTutorial3Step4#8](../ide/codesnippet/CSharp/step-4-add-the-checktheanswer-parens-method_1.cs)]

> [!IMPORTANT]
> 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>![Programming language control for Docs.Microsoft.com](../ide/media/docs-programming-language-control.png)
[!INCLUDE [devlang-control-csharp-vb](./includes/devlang-control-csharp-vb.md)]

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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ In the fifth part of this tutorial, you'll add <xref:System.Windows.Forms.Contro
[!code-vb[VbExpressTutorial3Step5_6#11](../ide/codesnippet/VisualBasic/step-5-add-enter-event-handlers-for-the-numericupdown-controls_1.vb)]
[!code-csharp[VbExpressTutorial3Step5_6#11](../ide/codesnippet/CSharp/step-5-add-enter-event-handlers-for-the-numericupdown-controls_1.cs)]

> [!IMPORTANT]
> 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>![Programming language control for Docs.Microsoft.com](../ide/media/docs-programming-language-control.png)
[!INCLUDE [devlang-control-csharp-vb](./includes/devlang-control-csharp-vb.md)]

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.

Expand Down
3 changes: 1 addition & 2 deletions docs/ide/step-6-add-a-subtraction-problem.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ In the sixth part of this tutorial, you'll add a subtraction problem and learn h
[!code-vb[VbExpressTutorial3Step5_6#12](../ide/codesnippet/VisualBasic/step-6-add-a-subtraction-problem_1.vb)]
[!code-csharp[VbExpressTutorial3Step5_6#12](../ide/codesnippet/CSharp/step-6-add-a-subtraction-problem_1.cs)]

> [!IMPORTANT]
> 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>![Programming language control for Docs.Microsoft.com](../ide/media/docs-programming-language-control.png)
[!INCLUDE [devlang-control-csharp-vb](./includes/devlang-control-csharp-vb.md)]

The names of the new integer variables—**minuend** and **subtrahend**—aren't programming terms. They're the traditional names in arithmetic for the number that's being subtracted (the subtrahend) and the number from which the subtrahend is being subtracted (the minuend). The difference is the minuend minus the subtrahend. You could use other names, because your program doesn't require specific names for variables, controls, components, or methods. You must follow rules such as not starting names with digits, but you can generally use names such as x1, x2, x3, and x4. However, generic names make code difficult to read and problems nearly impossible to track down. To keep variable names unique and helpful, you'll use the traditional names for multiplication (multiplicand × multiplier = product) and division (dividend ÷ divisor = quotient) later in this tutorial.

Expand Down
3 changes: 1 addition & 2 deletions docs/ide/step-7-add-multiplication-and-division-problems.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ In the seventh part of this tutorial, you'll add multiplication and division pro
[!code-vb[VbExpressTutorial3Step7#15](../ide/codesnippet/VisualBasic/step-7-add-multiplication-and-division-problems_1.vb)]
[!code-csharp[VbExpressTutorial3Step7#15](../ide/codesnippet/CSharp/step-7-add-multiplication-and-division-problems_1.cs)]

> [!IMPORTANT]
> 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>![Programming language control for Docs.Microsoft.com](../ide/media/docs-programming-language-control.png)
[!INCLUDE [devlang-control-csharp-vb](./includes/devlang-control-csharp-vb.md)]

2. As you did before, modify the `StartTheQuiz()` method to fill in random numbers for the multiplication and division problems.

Expand Down
3 changes: 1 addition & 2 deletions docs/ide/step-8-customize-the-quiz.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ In the last part of the tutorial, you'll explore some ways to customize the quiz
timeLabel.BackColor = Color.Red
```

> [!IMPORTANT]
> 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>![Programming language control for Docs.Microsoft.com](../ide/media/docs-programming-language-control.png)
[!INCLUDE [devlang-control-csharp-vb](./includes/devlang-control-csharp-vb.md)]

Reset the color when the quiz is over.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ Next, you use IntelliSense to enter more code to open an **Open File** dialog bo
1. Now add one more line of code. You can type it (or copy and paste it), but consider using IntelliSense to add it. The more familiar you are with IntelliSense, the more quickly you can write your own code. Your final `showButton_Click()` method should look similar to the following code.

> [!IMPORTANT]
> 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>![Programming language control for Docs.Microsoft.com](../ide/media/docs-programming-language-control.png)
[!INCLUDE [devlang-control-csharp-vb](./includes/devlang-control-csharp-vb.md)]

[!code-csharp[VbExpressTutorial1Step8#1](../ide/codesnippet/CSharp/step-8-write-code-for-the-show-a-picture-button-event-handler_1.cs)]

Expand Down
3 changes: 1 addition & 2 deletions docs/ide/step-9-review-comment-and-test-your-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ You just built something that works, and although it's not done yet, it can alre

1. Add the following comment to your code.

> [!IMPORTANT]
> 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>![Programming language control for Docs.Microsoft.com](../ide/media/docs-programming-language-control.png)
[!INCLUDE [devlang-control-csharp-vb](./includes/devlang-control-csharp-vb.md)]

[!code-csharp[VbExpressTutorial1Step9_10#1](../ide/codesnippet/CSharp/step-9-review-comment-and-test-your-code_1.cs)]

Expand Down

0 comments on commit 98b02f8

Please sign in to comment.