填空题
VB
题号 #483733
如右下图所示,在列表框List中已经有若干人的简单信息,运行时在Text1文本框(即“查找对象”右边的文本框)输入一个姓或姓名,单击“查找”按钮,则在列表框中进行查找,若找到,则把该人的信息显示在Text2文本框中。若有多个匹配的列表项,则只显示第1个匹配项;若未找到,则在Tcxt2中显示“查无此人”0请填空。
Private Sub Command 1_Click()
Dim k As Integer,n As Integer,found As Boolean
found=False
n=Len(【1】)
k=0
While k<List 1.List Count And Not found
If Text1=Left$(List1.List(k),n)Then
Text2= 【2】
found=True
End If
k=k+1
Wend
If Not found Then
Text2=“查无此人”
End If
End Sub

参考答案
暂无
答案解析
【1】Text1.Text【2】List1.List(k)【分析】从程序中可以看出,n的值应为Text1中文本的长度.所以.【1】处应填Text1.Text;根据题意,当找到需要的内容时,应该将找到的内容显示在Text2文本框中,由题目可知,在列表框中与查找内容匹配的列表项是List1.List(k)所以,【2】处应填List1.List(K)。
你可能感兴趣的试题
A.Private Sub Text1_lick()
Label 1.Caption=Text 1.Text
End Sub
Label 1.Caption=Text 1.Text
End Sub
B.Private Sub Text1_hange()
Label1.Caption=Text1.Text
End Sub
Label1.Caption=Text1.Text
End Sub
C.Private Sub Labe1 l_hange()
Label 1.Caption=Text 1.Text
End Sub
Label 1.Caption=Text 1.Text
End Sub
D.Private Sub Labl l_Click()
Label 1.Caption=Text1.Text
End Sub
Label 1.Caption=Text1.Text
End Sub
A.Private Sub List1_Click()
Label1.Caption=List1.ListIndex
List 1.RemoveItem List 1.Text
End Sub
Label1.Caption=List1.ListIndex
List 1.RemoveItem List 1.Text
End Sub
B.Private Sub List1_Click()
Label1.Name=List1.ListIndex
List1.RemoveItem List1.Text
End Sub
Label1.Name=List1.ListIndex
List1.RemoveItem List1.Text
End Sub
C.Private Sub List1_Click()
Label 1.Caption=List 1.Text
List 1.RemoveItem List 1.ListIndex
End Sub
Label 1.Caption=List 1.Text
List 1.RemoveItem List 1.ListIndex
End Sub
D.Private Sub List1_Click()
Label1.Name=List1.Text
List1.RemoveItem List1.ListIndex
End Sub
Label1.Name=List1.Text
List1.RemoveItem List1.ListIndex
End Sub