1个回答
展开全部
我刚才做的一个笨办法,你参考一下。窗体上就一个combo1
Dim j, z As Integer
Private Sub Combo1_Change()
If z = 0 Then
Dim i As Integer
Dim s, a As String
j = 0
a = Combo1.Text
For i = 0 To Combo1.ListCount - 1
If InStr(Combo1.List(i), a) = 1 Then
s = Combo1.List(j)
Combo1.List(j) = Combo1.List(i)
Combo1.List(i) = s
j = j + 1
End If
Next i
z = 1
Combo1.Text = a
Combo1.SelStart = Len(Trim(Combo1.Text))
End If
End Sub
Private Sub Combo1_KeyPress(KeyAscii As Integer)
z = 0
End Sub
Private Sub Form_Load()
Combo1.AddItem "bad"
Combo1.AddItem "bed"
Combo1.AddItem "abc"
Combo1.AddItem "agh"
z = 0
End Sub
Dim j, z As Integer
Private Sub Combo1_Change()
If z = 0 Then
Dim i As Integer
Dim s, a As String
j = 0
a = Combo1.Text
For i = 0 To Combo1.ListCount - 1
If InStr(Combo1.List(i), a) = 1 Then
s = Combo1.List(j)
Combo1.List(j) = Combo1.List(i)
Combo1.List(i) = s
j = j + 1
End If
Next i
z = 1
Combo1.Text = a
Combo1.SelStart = Len(Trim(Combo1.Text))
End If
End Sub
Private Sub Combo1_KeyPress(KeyAscii As Integer)
z = 0
End Sub
Private Sub Form_Load()
Combo1.AddItem "bad"
Combo1.AddItem "bed"
Combo1.AddItem "abc"
Combo1.AddItem "agh"
z = 0
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询