在窗口上添加一个文本框,两个命令框
Private Sub Command1_Click()
s = 0
For n = 1 To Val(Text1.Text)
s = s + n
Next
MsgBox s
End Sub '这是求和,文本框输入n,就是1到n的和
Private Sub Command2_Click()
k = 1
For n = 1 To Val(Text1.Text)
k = k * n
Next
MsgBox k
End Sub '这是求积,文本框输入n,就是1到n的积
s=0
for i=1 to 100
s=s+i
next