prova cosi

codice:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Randomize()
        Dim i As Integer = 0
        i = Int(Rnd() * 8) + 1 + 1
        Dim newVal As Integer = 0
        newVal = ProgressBar1.Value += i;
        
        If newVal < ProgressBar1.Maximum Then
            ProgressBar1.Value += newVal
        ElseIf ProgressBar1.Value = ProgressBar1.Maximum Then
            Timer1.Stop()
            MsgBox("End.")
            Me.Close()
        End If
    End Sub