Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i, t, sum As Integer
        i = 0
        t = 1
        sum = 0
        While sum < 1000
            i += 1
            t = t * i
            sum = sum + t
        End While
        MsgBox("i=" & Str(i) & " sum=" & Str(sum))
    End Sub
End Class
