窗体上有1个名称为List的列表框,其中已经输入了若干个项目(如图所示):还有2个文本框,名称分别为Text1、Text2, 1个名称为 Command1的命令按钮,并有以下程序
Private Sub Command1_Click()
Dim str As String, s As String, k As Integer
s=Text1
Str=””
For k=List1.ListCount-1 to 0 Step-1
If InStr(List.List(k),s)>0 then
str=str&List.List(k)&” ”
End If
Next k
If str=””Then
Text2=”没有匹配的项目”
Else
Text2=str
End If
End Sub
程序运行时,在Text1中输入“京”,单击命令按钮,则在Text2中显示的内容是( )。
A.京
B.北京 南京
C.南京
D.没有匹配的项目
第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
第2题:
窗倒上有1个名为List1的列表框,其中已经输入了若干个项目(如图3所示);还有2个文本框,名称分别为Text1、Text2,1个名称为Command1的命令按钮,并有以下程序:程序运行时,在Text1中输入“京”,单击命令按钮,则在Text2中显示的内容是( )。
A. 京
B. 北京南京
C. 南京北京
D. 没有匹配的项目
第3题:
窗体上有1个名称为List1的列表框,其中已经输入了若干个项目,如图所示;还有2个文本框,名称分别为Text1、Text2,1个名称为Command1的命令按钮,并有下列事件过程。 Private Sub Command1_Click( ) Dim str As String,S As String.k As Integer s=Text1 str ="" For k=Listl.ListCount-1 To 0 Step-1 If InStr(List1.List(k),s)>0 Then str=str & List1.List(k)&"" End If Next k If str=""Then Text2="没有匹配的项目" Else Text2=str End If End Sub程序运行时,在Text1中输入"京",单击命令按钮,则在Text2中显示的内容是( )。
A.京
B.北京南京
C.南京北京
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
第5题:
( 30 ) 窗体上有 1 个名称为 List 的列表框 , 其中已经输入了若干个项目 ( 如图所示 ) : 还有 2 个文本框 ,名称分别为 Text1 、 Text2, 1 个名称为 Command1 的命令按钮,并有以下程序
Private Sub Command1_Click ()
Dim str As String, s As String, k As Integer
s=Text1
Str= ””
For k=List1.ListCount-1 to 0 Step-1
If InStr ( List.List ( k ) ,s ) >0 then
str=str&List.List ( k ) & ” ”
End If
Next k
If str= ”” Then
Text2= ” 没有匹配的项目 ”
Else
Text2=str
End If
End Sub
程序运行时,在 Text1 中输入 “ 京 ” ,单击命令按钮,则在 Text2 中显示的内容是( )
A ) 京
B ) 北京 南京
C ) 南京
D ) 没有匹配的项目