VB 选中指定的combo1中的内容

2024-12-31 12:10:52
推荐回答(4个)
回答1:

Dim i As Integer
For i = 0 To Combo1.ListCount
If Text1.Text = Combo1.List(i) Then
Combo1.ListIndex = i
End If
Next

回答2:

combo1.style=1
Private Sub combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode <> 13 Then
combo1.Locked = True
End If
End Sub

Private Sub combo1_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode <> 13 Then
combo1.Locked = False
End If
End Sub

回答3:

只要做一个text的change事件就行了:
Private Sub Text1_Change()
For i = 0 To Combo1.ListCount Step 1
If Text1.Text = Combo1.List(i) Then
Combo1.Text = Text1.Text
End If
Next
End Sub

回答4:

dfsaf fdsaf ewerrl;kl ;l ;uoiu