1. “If then Statement” Activity
Do this:
1. Create a form that has 2 labels, 1 button and 1 textbox.
Double click the submit button and place the code below:
Private Sub Button1_Click(ByVal sender As System Object ByVal e As System. EventArgs)
Handles Button1. Click
Dim myAge As Integer
MyAge = Textbox1.Text
If myAge >= 60 Then
Label2. Text = “You have a discount. You are a Senior Citizen”
End If
End Sub
2. Press F5 or go to Debug > Start Debugging to run the program.
3. When Saving:
Filename: “DetermineAge” > Section’s Folder(4th Quarter files)
If Then Else Statement Activity
Do this:
1. Create a form that has 3 labels, 1 button and 1 textbox.
2. Double click the submit button and place the code below:
Private Sub Button1_Click(ByVal sender As System Object ByVal e As System.
EventArgs) Handles
Dim myMark As Integer
myMark = TextBox1.Text
If myMark > 75 Then
Label3.Text = “A’’
Else
Label3. Text = “B”
End If
End Sub
2. 4. Press F5 or go to Debug > Start Debugging to run the program.
5. When Saving:
Filename: “MarkEvaluation” > Section’s Folder(4th Quarter files)
If Then Elself Statement Activity
Do this:
1. Create a form that has 3 labels, 1 submit button and 1 textbox.
2. Double click the submit button and place the code below:
Private Sub Button1_Click(ByVal sender As System Object ByVal e As System.
EventArgs) Handles
Dim myMark As Single
myMark = Textbox1. Text
Select myMark
Case 0 to 49
Label3. Text = “Need to work harder”
Case 50 to 59
Label3. Text = “Average”
Case 60 to 69
Label 3. Text = “Above Average”
Case 70 to 84
Label3. Text = “Good”
Case Else
Label 3. Text = “Excellence”
End Select
3. Press F5 or go to Debug > Start Debugging to run the program.
4. When Saving:
Filename: “MarkEvaluation2” > Section’s Folder(4th Quarter files)