Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i As Integer, sum As Integer
        sum = 0
        For i = 1 To 100          ' 也可以改为For i = 100 To 1 Step -1
            sum = sum + i
        Next i
        MsgBox("1+2+3+…+100=" & Str(sum), , "累加")
    End Sub
End Class
