您的位置首页百科快答

用vb中的list box的list index来怎么解决这个问题?

用vb中的list box的list index来怎么解决这个问题?

的有关信息介绍如下:

用vb中的list box的list index来怎么解决这个问题?

form1的代码:

Option Explicit

Private Sub Combo1_Click()

If Combo1.Text = "5" Then

Form2.Show

Me.Hide

End If

End Sub

Private Sub Form_Load()

Dim i As Integer

For i = 1 To 10

Combo1.AddItem i

Next i

Combo1.Text = Combo1.List(0)

End Sub

form2的代码:

Option Explicit

Private Sub Form_Load()

Dim i As Integer

List1.Clear

For i = 1 To 8

List1.AddItem i

Next i

End Sub

Private Sub List1_Click()

Dim i As Integer

For i = 0 To List1.ListCount - 1

If List1.Selected(i) And List1.List(i) = "3" Then

Form1.Show

Unload Me

Exit For

End If

Next i

End Sub