Dim point As Integer

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Randomize()
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim die1 As Integer
Dim die2 As Integer
Dim roll As Integer
die1 = Int(Rnd() * 6) + 1
die2 = Int(Rnd() * 6) + 1
roll = die1 + die2
Label2.Text = Int(Rnd() * 6) + 1
Label3.Text = Int(Rnd() * 6) + 1

If roll = 2 Or roll = 3 Or roll = 12 Then
Label1.Text = "Lose"
GroupBox2.Visible = False
ElseIf roll = 7 Or roll = 11 Then
Label1.Text = "Win"
GroupBox2.Visible = False
Else : roll = 4 Or roll = 5 Or roll = 6 Or roll = 8 Or roll = 9 Or roll = 10
point = roll
Label4.Text = point
Label1.Text = "Point"
GroupBox2.Visible = True
End If

If Label4.Text = point Then
GroupBox2.Visible = False
Label1.Text = "win"
ElseIf roll = 7 Then
GroupBox2.Visible = False
Label1.Text = "Lose"
Else : roll = 2 Or roll = 3 Or roll = 4 Or roll = 5 Or roll = 6 Or roll = 8 Or roll = 9 Or roll = 10 Or roll = 11 Or roll = 12
GroupBox2.Visible = True
Label1.Text = "Roll"
End If

End Sub

End Class


Please help with this code. It is the game of craps and it is definitely not working the way it should. Any help would be greatly appreciated.

Label2.Text = Int(Rnd() * 6) + 1
Label3.Text = Int(Rnd() * 6) + 1

i think u want to display die 1 an die2 in label2 and label3...but u call the Rnd again......which give different value each time

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.