题库 高中信息

题干

编写VB程序,实现如下功能:在文本框Text1中输入包含数字、字母、符号等的字符串,单击“统计”按钮Cmd_1,统计该字符串中数字字符的个数,并在标签Label1中输出结果。界面如图所示。
(1)在设计界面时,应使用右图所示“控件工具箱”中的_____(填写相应编号)添加“统计”按钮。

(2)为实现上述功能,请在处填入合适代码。
Private Sub Command1_Click()
Dim s As String, c As String
Dim i As Integer, n As Integer, num As Integer
s = Text1.Text: num = 0
n =  ①___________
i = 1
Do While i <= n
c = Mid(s, i, 1)
If ②_____________ Then
num = num + 1
End If
i = i + 1
③_______
Label1.Caption = Str(num)
End Sub
(3)在VB中运行程序,出现“要求对象”的错误,原因是:_______________________。
上一题 下一题 0.99难度 填空题 更新时间:2019-03-02 02:54:47

答案(点此获取答案解析)