[Solved] Visual Basic Text Box Array for random number generator


Try to use a foreach loop for all textboxes as below:

Dim RandomNumberAHigh As Integer = 12
Dim RandomNumberALow As Integer = 1
Dim Random As Integer = 0
For Each txt As Control In Me.Controls
    If TypeOf txt Is TextBox Then
        txt.Text = Int((RandomNumberAHigh - RandomNumberALow + 1) * Rnd() + RandomNumberALow)
    End If
Next

1

solved Visual Basic Text Box Array for random number generator