问题
单项选择题
在窗体上画一个名称为List1的列表框,一个名称为Label1的标签。列表框中显示若干国家的名称,当单击列表中的某个国家名时,在标签中显示选中国家的名称。下列正确实现上述功能的程序是( )。
A.Private Sub List1_Click()
Labe11. Camion=List1. ListIndex
End Sub
B.Private Sub List1_Click()
Labe11. Name=List1. ListIndex
End Sub
C.Private Sub List1_Click()
Labe11.Name=List1. Text
End Sub
D.Private Sub List1_Click()
Labe11. Caption=List1. Text
End Sub
答案
参考答案:D
解析: ListIndex属性返回或设置控件中当前列表项的索引号; Text属性返回列表框中当前列表项的文本内容;Label1标签在Caption属性中显示内容,而Name属性代表Label1的名字。