Salve, ho problemi con una progress bar... Quando la barra sta per arrivare al massimo, ottengo un errore. Ecco uno screenshot del messaggio di errore che mi appare:

http://i47.tinypic.com/wire9s.png

Probabilmente il timer non si blocca quando la barra arriva al massimo, però io ho messo controlli (if) praticamente dappertutto, ecco un po' il codice

codice:
 Randomize()
        Me.Timer1.Enabled = True
        Dim d As Integer = 0
        d = Int(Rnd() * 2000) + 1 + 1
        Me.Timer1.Interval = d
---

codice:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Timer1.Enabled = True

      

    End Sub

    Friend WithEvents Timer1 As System.Windows.Forms.Timer

    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
        If ProgressBar1.Value < ProgressBar1.Maximum Then
            ProgressBar1.Value += i
        ElseIf ProgressBar1.Value = ProgressBar1.Maximum Then
            Timer1.Stop()
            MsgBox("End.")
            Me.Close()
        End If
    End Sub