在窗体上画一个名称为List1的列表框,一个名称为Label1的标签,列表框中显示若干个项目。当单击列表框中的某个项目时,在标签中显示被选中项目的名称。下列能正确实现上述操作的程序是( )。A.Private Sub List1_Click()Label1.Caption = List1.ListIndexEnd SubB.Private Sub List1_Click()Label1.Name=List1.ListIndexEnd SubC.Private Sub List1_Click()Label1

题目

在窗体上画一个名称为List1的列表框,一个名称为Label1的标签,列表框中显示若干个项目。当单击列表框中的某个项目时,在标签中显示被选中项目的名称。下列能正确实现上述操作的程序是( )。

A.Private Sub List1_Click()

Label1.Caption = List1.ListIndex

End Sub

B.Private Sub List1_Click()

Label1.Name=List1.ListIndex

End Sub

C.Private Sub List1_Click()

Label1.Name=List1.Text

End Sub

D.Private Sub List1_Click()

Label1.Caption =List1.Text

End Sub


相似考题
更多“在窗体上画一个名称为List1的列表框,一个名称为Label1的标签,列表框中显示若干个项目。当 ”相关问题
  • 第1题:

    在窗体上画一个名称为List1的列表框,一个名称为Label1的标签,列表框中显示若干个项目。当单击列表框中的某个项目时,在标签中显示被选中项目的名称。下列能正确实现上述操作的程序是

    A.Private Sub List1_Click( ) Label1.Caption=List1.List1ndex End Sub

    B.Private Sub List1_Click( ) Label1.Name=List1.List1ndex End Sub

    C.Private Sub List1_Click( ) Label1.Name=List1.Text End Sub

    D.PrivateSubList1_Click( ) Label1.Caption=List1.Text End Sub


    正确答案:D
    解析:题中要求在Label中显示内容,则使用的是其Caption属性,而列表框的List1ndex属性指的是程序运行时被选定的选项的序号,而Text属性是被选定的选项的文本内容。

  • 第2题:

    在窗体上画一个名称为List1的列表框,一个名称为Label1的标签。列表框中显示若干城市的名称。当单击列表框中的某个城市名时,在标签中显示选中城市的名称。下列能正确实现上述功能的程序是

    A.Private Sub List1 Click() Label1.Caption=List1.List- Index End Sub

    B.Private Sub List1_Click() Label1.Name=List1. ListIn- dex End Sub

    C.Private Sub List1 Click() Label1.Name=List1.Text End Sub

    D.Private Sub List1_Click() Label1.Caption=List1.Text End Sub


    正确答案:D
    解析:要实现在标签上显示选中城市的名称,很容易想到需使用标签的Caption属性。标签的Caption属性我们前面已经介绍过。怎样获取选中城市的名称要结合列表List的属性来考虑。其中Text属性表示最后选中列表项的内容。故正确语句应为Label1.Caption=List1.Text。选项D正确。

  • 第3题:

    在窗体上画一个List1的列表框,一个名称为Label1的标签,列表框中显示若干个项目,当单击列表框中的某个项目时,在标签中显示被选中的项目的名称,下列能正确实现上述操作的程序是( )。

    A) Private Sub List1_Click()

    Label1.Caption = List1.ListIndex

    End Sub

    B) Private Sub List1_Click()

    Label1.Name = List1.ListIndex

    End Sub

    C) Private Sub List1_Click()

    Label1.Name = List1.Text

    End Sub

    D) Private Sub List1_Click()

    Label1.Caption = List1.Text

    End Sub


    正确答案:D

  • 第4题:

    在窗体上绘制一个名称为List1的列表框,一个名称为Labe11的标签,列表框中显示若干个项目。当单击列表框中的某个项目时,在标签中显示被选中项目的名称。下列能正确实现上述操作的程序是

    A.PriVate Sub List1_Click() Labell.CaptiOn=List.ListIndex End Sub

    B.PriVate Sub List1_Click() Labell.Name=listl.ListIndex End Sub

    C.Private Sub List1_Click() Labell.Name=Listl.Text End Sub

    D.Private Sub List1_Click() Labell.Caption=List1.Text End Sub


    正确答案:D
    解析:本题考查列表框的属性。列表框属性是历年考试重点,考生应多做相关练习。本题要注意区分ListIndex与Text属性。 ListIndex指被选中项的下标,而Text表示被选中项的内容。List1.Listlndex表示被选中的项本身,而 List1.Text表示被选中项的内容,故本题正确答案是A。同时本题还涉及Name与Caption的区别,考生也要注意区分。

  • 第5题:

    在窗体上画一个名称为List1的列表框,一个名称为Labe11的标签,列表框中显示若干城市的名称。当单击列表框中的某个城市名时,该城市名从列表框中消失,并在标签中显示出来。下列能正确实现上述操作的程序是( )。

    A.

    B.

    C.

    D.


    正确答案:C