Sub
Command1_Click()
Dim
a,
s
As
Integer
a
=
Val(Text1.Text)
s
=
0
For
i
=
1
To
a
Step
1
'从1加到文本框中输的数字,重复执行i=i+1
s
=
s
+
i
's=s+i
Next
i
Label1.Caption
=
s
'输出结果
End
Sub
最好加个按钮,按钮事件写:Private Sub Command1_Click()
if text1.text <咐氏敬>"" And Text2.text<>"" then
Text3.Text = Val(Text1.Text) + Val(Text2.Text)
else
MsgBox"请输入这两衡慎核大个数!"
end sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)