combobox控件用法(combobox控件)
VB combo 随输入内容 调整下拉框 Option Explicit Dim namestr() Private Sub Form_Load() ReDim namestr(1 To 5) namestr(1) = "陈好" namestr(2) = "陈很好" namestr(3) = "陈特好" namestr(4) = "陈贼好" namestr(5) = "陈好不好" End Sub Private Sub Combo1_Change() Static a As Boolean If a Then Exit Sub Dim i As Integer Dim p As Integer Dim s As String a = True If Combo1.Text = "" Then Exit Sub p = Combo1.SelStart s = Combo1.Text Combo1.Clear For i = 1 To 5 If InStr(1, namestr(i), s) = 1 Then Combo1.AddItem namestr(i) Next i Combo1.Text = s Combo1.SelStart = p a = False End Sub。