0% found this document useful (0 votes)
29 views

Exercise 13

This code handles the click event of a button. It defines color variables and reads text from text boxes to check for correct color combinations, incrementing counters for correct answers and position matches. On each button click, it displays the number of correct answers and position matches.

Uploaded by

api-307933689
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Exercise 13

This code handles the click event of a button. It defines color variables and reads text from text boxes to check for correct color combinations, incrementing counters for correct answers and position matches. On each button click, it displays the number of correct answers and position matches.

Uploaded by

api-307933689
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Exercise 13

Public Class Form1


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim BLUE As Integer = 1
Dim GREEN As Integer = 2
' Red (1)
Blue(2) gREEN(3)
Dim YELLOW As Integer = 3
Dim RED As Integer = 4
Static Position As Integer = 0
Static Correct As Integer = 0
Dim First As Char = TextBox1.Text
Dim Second As Char = TextBox2.Text
Dim Third As Char = TextBox3.Text
Select Case First
Case "R"
Position += 1
Correct += 1
Case "B"
Correct += 1
Case "G"
Correct += 1
End Select
Select Case Second
Case "R"
Correct += 1
Case "B"
Position += 1
Correct += 1
Case "G"
Correct += 1
End Select
Select Case Third
Case "R"
Correct += 1
Case "B"
Correct += 1
Case "G"
Position += 1
Correct += 1
End Select
Label1.Text = Correct
Label2.Text = Position
End Sub
End Class

You might also like