If i > 10 Then Exit For
Next
Text1.Text = Str(n)
End Sub
程序运行后,单击命令按钮,在文本框中显示的值是
A)5 B)4 C)3 D)2
(20)在窗体上画一个命令按钮和两个标签,其名称分别为Command1、Label1和Label2,然后编写如下事件过程:
Private Sub Command1_Click()
a = 0
For i = 1 To 10
a = a + 1
b = 0
For j = 1 To 10
a = a + 1
b = b + 2
Next j
Next i
Label1.Caption = Str(a)
Label2.Caption = Str(b)
End Sub
程序运行后,单击命令按钮,在标签Label1和Label2中显示的内容分别是
A)10和20 B)20和110 C)200和110 D)110和20
(21)在窗体上画一个名称为List1的列表框,一个名称为Label1的标签,列表框中显示若干城市的名称。当单击列表框中的某个城市名时,该城市名从列表框中消失,并在标签中显示出来。下列能正确实现上述操作的程序是
A)Private Sub List1_Click() B)Private Sub List1_Click()
Label1.Caption = List1.ListIndex Label1. Name = List1. ListIndex
List1.RemoveItem List1.Text List1.RemoveItem List1.Text
End Sub End Sub
C)Private Sub List1_Click() D)Private Sub List1_Click()
Label1.Caption = List1.Text Label1.Name = List1.Text
List1.RemoveItem List1.ListIndex List1.RemoveItem List1.ListIndex
End Sub End Sub
(22)在窗体上画一个名称为Command1的命令按钮,然后编写如下程序:
Private Sub Command1_Click()
Dim i As Integer, j As Integer
Dim a(10, 10) As Integer
For i = 1 To 3
For j = 1 To 3
a(i, j) = (i - 1) * 3 + j
Print a(i, j);
Next j
Print
Next i
|