Hello, this is a homework assignment for my class. I have a form that has four text boxes that display dice rolls(1-7) two dice for each player. My only question is how can I call the results of sumoffaces and at it to my textboxes and display the rolls of the dice in the text boxes also.
Public Class Form1
Public Class highroller
Dim WithEvents roll As New pairofdice
'determines player 1 roll of dice
Class pairofdice
Private m_die1, m_die2 As Integer
Dim randomnum As New Random()
Public ReadOnly Property die1() As Integer
Get
Return m_die1
End Get
End Property
Public ReadOnly Property die2() As Integer
Get
Return m_die2
End Get
End Property
Public ReadOnly Property sumoffaces() As Integer
Get
Return m_die1 + m_die2
End Get
End Property
Sub roll()
m_die1 = randomnum.Next(1, 7)
m_die2 = randomnum.Next(1, 7)
End Sub
End Class
Sub wasteoftime()
For x As Integer = 0 To 10000000
Next
End Sub
'determines player 2 roll of dice
Class pairofdice2
Private m_die3, m_die4 As Integer
Dim randomnum As New Random()
Public ReadOnly Property die1() As Integer
Get
Return m_die3
End Get
End Property
Public ReadOnly Property die2() As Integer
Get
Return m_die4
End Get
End Property
Public ReadOnly Property sumoffaces() As Integer
Get
Return m_die3 + m_die4
End Get
End Property
Sub roll()
m_die3 = randomnum.Next(1, 7)
m_die4 = randomnum.Next(1, 7)
End Sub
Dim player2 As Integer = sumoffaces
End Class
End Class
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Dim player1 As Integer
Dim player2 As Integer
Private Sub rollbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rollbtn.Click
'used to start the game and then display the winner
dicebox1.Text = highroller.roll
End Sub
Dim die As highroller
End Class