- 12
- 0
- 约3.44千字
- 约 18页
- 2016-11-27 发布于湖北
- 举报
4.1
代码
Private Sub Text1_Change()
If Len(Text1.Text) 15 Then
Text2.SetFocus
End If
End Sub
实验结果
4.2
题目
在窗体上有3个名称分别为Text1、Text2和Text3的文本框,一个名称为C1,标题为计算的命令按钮,如图4-4所示。要求程序运行后,在Text1和Text2中分别输入两个整数,单击计算按钮后,可把两个整数之间的所有整数(含两个整数)累加起来并在Text3中显示。
代码
Dim a%, b%, c%
Private Sub Command1_Click()
a = Text1.Text
b = Text2.Text
c = ((b - a + 1) * (b + a)) / 2
Text3.Text = Val(c)
End Sub
实验结果
4.3
题目
代码
Dim a%, s%
Private Sub Command1_Click()
s = 0
For a = 100 To 200
If a Mod 3 = 0 Then
s = s + a
End If
Next a
Text1.Text = s
End Sub
实验结果
4.4
题目
代码
D
原创力文档

文档评论(0)