1个回答
展开全部
' --- 完整程序如下, VB6 ---
'添加1个Form,Name=Form1
'添加1个ListBox, Name=List1
'添加1个TextBox, Name=Text1
Option Explicit
Private Sub Form_Load()
List1.AddItem "item1"
List1.AddItem "item2"
List1.AddItem "item3"
End Sub
Private Sub Command1_Click()
Dim N As Integer
For N = 0 To List1.ListCount - 1
If Text1.Text = List1.List(N) Then
'--- 显示对话框 ---
MsgBox "Item found! Index = " + CStr(N)
Exit For
End If
Next N
End Sub
' --- 完整程序如上, VB6 ---
'添加1个Form,Name=Form1
'添加1个ListBox, Name=List1
'添加1个TextBox, Name=Text1
Option Explicit
Private Sub Form_Load()
List1.AddItem "item1"
List1.AddItem "item2"
List1.AddItem "item3"
End Sub
Private Sub Command1_Click()
Dim N As Integer
For N = 0 To List1.ListCount - 1
If Text1.Text = List1.List(N) Then
'--- 显示对话框 ---
MsgBox "Item found! Index = " + CStr(N)
Exit For
End If
Next N
End Sub
' --- 完整程序如上, VB6 ---
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |