I am trying to write a program that will keep track of a players wins everything works except can anyone tell me why my if statement wont work?

You are comparing the NAMES of the two players instead of the values and the comparison for the second player should be an else if for the first if

' calculate and display total number of dots
intTotal = intNum1 + intNum2
lblTotal.Text = intTotal.ToString()

intTotal2 = intNum3 + intNum4
lblTotal2.Text = intTotal2.ToString()

If intTotal > intTotal2 Then
    MessageBox.Show("Player1 Wins")
    Player1Wins = Player1Wins + 1
    lblWins.Text = CStr(Player1Wins)
Else If intTotal2 > intTotal1 Then
    Player2Wins = Player2Wins + 1
    lblWins2.Text = CStr(Player2Wins)
    Tie = Tie + 1
    lblTies.Text = CStr(Tie)
End If

And the label update should be after the increment of the counter for wins and ties

Leave a Comment