Posted By: Lucid

## Help with VB.net Program - 12/03/04 05:42 AM

The purpose of the program is to simulate rolling a six sided die. Then the program keeps track of the frequency of each roll, the number of total rolls and the probability . My problem is that every time my program simulates rolling a one it prints to Frq1 and does not increment correctly. I want it to increment each time by one starting from a value of zero. Any help would be greatly appreciated.

Code:

Private Sub Calculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Calculate.Click

Dim Frequency As Double

Dim Probability As Decimal

Dim DieNumber As Integer

Dim One, Two, Three, Four, Five, Six As Integer

One = 0

IncrementCounter:

Randomize()

DieNumber = CInt(Int((6 * Rnd()) + 1))

Results.Items.Add(DieNumber)

Select Case True

Case DieNumber = 1

One = One + 1

Frq1.Items.Add(One)

GoTo IncrementCounter

End Select

Code:

Private Sub Calculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Calculate.Click

Dim Frequency As Double

Dim Probability As Decimal

Dim DieNumber As Integer

Dim One, Two, Three, Four, Five, Six As Integer

One = 0

IncrementCounter:

Randomize()

DieNumber = CInt(Int((6 * Rnd()) + 1))

Results.Items.Add(DieNumber)

Select Case True

Case DieNumber = 1

One = One + 1

Frq1.Items.Add(One)

GoTo IncrementCounter

End Select