every time i press the Roll Dice button the turn1roll1, turn1roll2, or turn2roll1, turn2roll2(depending on turn variable) it shows system.random
in ASCII Chart i used the label names so no confusion ^^
_________________________________
| turn1roll1 | turn1roll2 | turn1sum |
| turn2roll1 | turn2roll2 | turn2sum |
| |
| |
| |
| |
| |
| |
| |
| [RollDice] |
| |
| |
__________________________________
Code:Public Class Form1 Dim turn = 1 Private Sub RollDice_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Dice.Click Dim die1 As New Random Dim die2 As New Random Dim roll As Integer = die1.Next(1, 7) + die2.Next(1, 7) If turn = 1 Then turn1roll1.Text = die1.ToString turn1roll2.Text = die2.ToString turn1sum.Text = roll.ToString turn = turn + 1 ElseIf turn = 2 Then Dim roll2 As Integer = die1.Next(1, 7) + die2.Next(1, 7) turn2roll1.Text = die1.ToString turn2roll2.Text = die2.ToString turn2sum.Text = roll2.ToString turn = turn - 1 End If End Sub




Reply With Quote
