Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Match Game Attempt

$
0
0

I am attempting to get a simple match code to work. Essentially on next button push it displays a random flag *this works*, then the user clicks a county name button which matches the flag displayed, and gets a message of either "You are correct" or "That is incorrect, Try again"

As it is now the check is not working since it always displays the incorrect message no matter which radio button is chosen

Code

Public Class Game

    Private Sub BTNNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNNext.Click
        Dim rndnumber As New Random
        Dim result As Integer = rndnumber.Next(1, 5)

        'CLear all previous entries 
        RDOUSGame.Checked = False
        RDOCanGame.Checked = False
        RDOMexGame.Checked = False
        RDOJapGame.Checked = False

        If result = 1 Then
            Picflagbox.Image = My.Resources.FLGUSA02
        ElseIf result = 2 Then
            Picflagbox.Image = My.Resources.FLGMEX
        ElseIf result = 3 Then
            Picflagbox.Image = My.Resources.FLGJAPAN
        ElseIf result = 4 Then
            Picflagbox.Image = My.Resources.FLGCAN
        End If
    End Sub



    Private Sub RDOUSGame_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RDOUSGame.CheckedChanged
        If RDOUSGame.Checked = True AndAlso Picflagbox.Image Is My.Resources.FLGUSA02 Then
            LBLResult.Text = "You are correct"
        Else
            LBLResult.Text = "That is Incorrect, please try again."
        End If
    End Sub

    Private Sub RDOCanGame_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RDOCanGame.CheckedChanged
        If RDOCanGame.Checked = True AndAlso Picflagbox.Image Is My.Resources.FLGCAN Then
            LBLResult.Text = "You are correct"
        Else
            LBLResult.Text = "That is Incorrect, please try again."
        End If
    End Sub

    Private Sub RDOMexGame_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RDOMexGame.CheckedChanged
        If RDOMexGame.Checked = True AndAlso Picflagbox.Image Is My.Resources.FLGMEX Then
            LBLResult.Text = "You are correct"
        Else
            LBLResult.Text = "That is Incorrect, please try again."
        End If
    End Sub

    Private Sub RDOJapGame_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RDOJapGame.CheckedChanged
        If RDOJapGame.Checked = True AndAlso Picflagbox.Image Is My.Resources.FLGJAPAN Then
            LBLResult.Text = "You are correct"
        Else
            LBLResult.Text = "That is Incorrect, please try again."
        End If
    End Sub


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>