vb中combobox中选择键盘输入数据
1个回答
2015-10-19
展开全部
Dim x() As String
Private Sub Combo1_KeyUp(KeyCode As Integer, Shift As Integer)
Dim i As Integer, str1 As String, ch As Boolean
str1 = Combo1.Text
Combo1.Clear
For i = 0 To UBound(x)
If Left(x(i), Len(str1)) = str1 Then
Combo1.AddItem x(i)
ch = True
End If
Next
Combo1.Text = str1
Combo1.SelStart = Len(str1)
If ch Then
Combo1.ListIndex = 0
End If
End Sub
Private Sub Form_Load()
Dim i As Integer
ReDim x(99)
For i = 0 To 99
x(i) = i + 10
Combo1.AddItem i + 10
Next
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询