Skip to content

Commit ea00331

Browse files
committed
Add info adding code file name for each code block
1 parent ef5bff2 commit ea00331

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

docs/get-started/csharp/tutorial-windows-forms-match-game-icons.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ To learn more about lists, see <xref:System.Collections.Generic.List%601>. To se
7777
Each time you run the program, it assigns the icons randomly to the Label controls on your form by using an `AssignIconsToSquares()` method.
7878
This code uses the keyword `foreach` in C# or `For Each` in Visual Basic.
7979

80-
1. Add the `AssignIconsToSquares()` method.
80+
1. Add the `AssignIconsToSquares()` method to `Form1.cs` or `Form1.vb`.
8181

8282
### [C#](#tab/csharp)
8383
:::code language="csharp" source="../../snippets/csharp/VS_Snippets_VBCSharp/vbexpresstutorial4step2_3_4/cs/form1.cs" id="Snippet2":::
@@ -108,13 +108,13 @@ This code uses the keyword `foreach` in C# or `For Each` in Visual Basic.
108108
The line is commented out here so you can verify the rest of the code before proceeding.
109109
- The last line in the `if` statement removes the icon that has been added to the form from the list.
110110

111-
1. Add a call to the `AssignIconsToSquares()` method to the **Form1** *constructor*.
111+
1. Add a call to the `AssignIconsToSquares()` method to the **Form1** *constructor* in `Form1.cs`.
112112
This method fills the game board with icons.
113113
Constructors are called when you create an object.
114114

115115
:::code language="csharp" source="../../snippets/csharp/VS_Snippets_VBCSharp/vbexpresstutorial4step2_3_4/cs/form1.cs" id="Snippet13":::
116116

117-
For Visual Basic, add the `AssignIconsToSquares()` method call to the `Form1_Load` method.
117+
For Visual Basic, add the `AssignIconsToSquares()` method call to the `Form1_Load` method in `Form1.vb`.
118118

119119
```vb
120120
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
@@ -135,7 +135,7 @@ This code uses the keyword `foreach` in C# or `For Each` in Visual Basic.
135135

136136
The icons are visible now because you haven't hidden them. To hide them from the player, you can set each label's **ForeColor** property to the same color as its **BackColor** property.
137137

138-
1. Stop the program. Remove the comment marks for the commented line of code inside the loop.
138+
1. Stop the program. Remove the comment marks for the commented line of code inside the loop in the `AssignIconsToSquares()` method
139139

140140
### [C#](#tab/csharp)
141141
:::code language="csharp" source="../../snippets/csharp/VS_Snippets_VBCSharp/vbexpresstutorial4step2_3_4/cs/form1.cs" id="Snippet15":::
@@ -168,7 +168,7 @@ To get your game to work this way, add a <xref:System.Windows.Forms.Control.Clic
168168

169169
![Screenshot shows the Properties window showing Click event.](../media/tutorial-windows-forms-match-game-icons/click-event.png)
170170

171-
1. Select the **Enter** key. The IDE adds a `Click` event handler called **label1 _Click()** to the code.
171+
1. Select the **Enter** key. The IDE adds a `Click` event handler called **label1 _Click()** to the code in **Form1.cs** or **Form1.vb**.
172172
Because you selected all the labels, the handler is hooked to each of the labels.
173173

174174
1. Fill in the rest of the code.

docs/get-started/csharp/tutorial-windows-forms-match-game-labels.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.author: meghaanand
99
manager: mijacobs
1010
ms.subservice: general-ide
1111
ms.topic: tutorial
12-
ms.date: 03/16/2023
12+
ms.date: 10/18/2024
1313
ms.custom: vs-acquisition
1414
---
1515
# Tutorial: Add reference variables and a timer control to your matching game WinForms app
@@ -38,7 +38,7 @@ Complete those tutorials first.
3838
In this section, you'll add two *reference variables* to your code.
3939
They keep track of, or refer to Label objects.
4040

41-
1. Add label references to your form by using the following code.
41+
1. Add label references to your form by using the following code in `Form1.cs` or `Form1.vb`.
4242

4343
### [C#](#tab/csharp)
4444
:::code language="csharp" source="../../snippets/csharp/VS_Snippets_VBCSharp/vbexpresstutorial4step5/cs/form1.cs" id="Snippet5":::
@@ -50,7 +50,7 @@ They keep track of, or refer to Label objects.
5050
These statements don't cause Label controls to appear on the form because there's no `new` keyword.
5151
When the program starts, both `firstClicked` and `secondClicked` are set to `null` for C# or `Nothing` for Visual Basic.
5252

53-
2. Modify your <xref:System.Windows.Forms.Control.Click> event handler to use the new `firstClicked` reference variable.
53+
2. Modify your <xref:System.Windows.Forms.Control.Click> event handler in `Form1.cs` or `Form1.vb` to use the new `firstClicked` reference variable.
5454
Remove the last statement in the `label1_Click()` event handler method (`clickedLabel.ForeColor = Color.Black;`) and replace it with the `if` statement as follows.
5555

5656
### [C#](#tab/csharp)
@@ -94,7 +94,7 @@ If the icons don't match, it hides the two icons again after a short period of t
9494
Your program calls the <xref:System.Windows.Forms.Timer.Start> method to start the timer after the player chooses the second label.
9595

9696
4. Choose the timer control icon and then press **Enter**, or double-click the timer.
97-
The IDE adds an empty Tick event handler.
97+
The IDE adds an empty Tick event handler to `Form1.cs` or `Form1.vb`.
9898
Replace the code with the following code.
9999

100100
### [C#](#tab/csharp)
@@ -109,7 +109,7 @@ If the icons don't match, it hides the two icons again after a short period of t
109109
- It uses two reference variables, `firstClicked` and `secondClicked`, to make the icons of the two labels that the player chose invisible again.
110110
- It resets the `firstClicked` and `secondClicked` reference variables to `null` in C# and `Nothing` in Visual Basic.
111111

112-
5. Go to the code editor and add code to the top and bottom of the `label1_Click()` event handler method.
112+
5. Go to the code editor and add code to the top and bottom of the `label1_Click()` event handler method in `Form1.cs` or `Form1.vb`.
113113
This code will check if the timer is enabled, set the `secondClicked` reference variable, and start the timer.
114114
The `label1_Click()` event handler method now looks as follows:
115115

0 commit comments

Comments
 (0)