I just finished creating a programming (Be advised I am a beginner at this programming stuff) I was going for an idea of making a program that asks a user how many times they want to throw a set of three 6 sided dies, once the program has that input number of throws from the user, it will find out the out come of each throw and place it into a total integer so that it can be moved to a textbox to show how many times that number came up during the number of rolls almost like a tally system. Now I might be doing this the total wrong way or my logic might not be the greatest at programming but any help would be amazing I will post my code so far below
Public Class Form1
Dim Numthrow As Integer
Dim threetotal, fourtotal, fivetotal, sixtotal, sevtotal, eighttotal, ninetotal, tentotal, eeltotal As Integer
Dim twtotal As Integer
Dim threeteentotal As Integer
Dim fourteentotal As Integer
Dim fiveteentotal As Integer
Dim sixteentotal As Integer
Dim eightteentotal As Integer
Dim nineteentotal As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Numthrow = TextBox1.Text
For index = 0 To Numthrow
Dim oDice As New Random
Dim iDiceResult As Integer = oDice.Next(2, 19)
If iDiceResult = 3 Then
threetotal = threetotal + 1
End If
If iDiceResult = 4 Then
fourtotal = fourtotal + 1
End If
If iDiceResult = 5 Then
fivetotal = fivetotal + 1
End If
If iDiceResult = 6 Then
sixtotal = sixtotal + 1
End If
If iDiceResult = 7 Then
sevtotal = sevtotal + 1
End If
If iDiceResult = 8 Then
eighttotal = eighttotal + 1
End If
If iDiceResult = 9 Then
ninetotal = ninetotal + 1
End If
If iDiceResult = 10 Then
tentotal = tentotal + 1
End If
If iDiceResult = 11 Then
eeltotal = eeltotal + 1
End If
If iDiceResult = 12 Then
twtotal = twtotal + 1
End If
If iDiceResult = 13 Then
threeteentotal = threeteentotal + 1
End If
If iDiceResult = 14 Then
fourteentotal = fourteentotal + 1
End If
If iDiceResult = 15 Then
fiveteentotal = fiveteentotal + 1
End If
If iDiceResult = 16 Then
sixteentotal = sixteentotal + 1
End If
If iDiceResult = 17 Then
sevtotal = sevtotal + 1
End If
If iDiceResult = 18 Then
eightteentotal = eightteentotal + 1
End If
Next
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
threetotal = 0
fourtotal = 0
fivetotal = 0
sixtotal = 0
sevtotal = 0
eighttotal = 0
ninetotal = 0
tentotal = 0
eeltotal = 0
twtotal = 0
threeteentotal = 0
fourteentotal = 0
fiveteentotal = 0
sixteentotal = 0
sevtotal = 0
eightteentotal = 0
End Sub
End Class