| 以下为引用的内容:
源代码网整理以下 Private Sub AutoCompleteKeyUp(ByVal Combo As ComboBox, ByVal e As KeyEventArgs)
源代码网整理以下 Dim strTyped As String
源代码网整理以下 Dim intFoundIndex As Integer
源代码网整理以下 Dim objFoundItem As Object
源代码网整理以下 Dim strFoundText As String
源代码网整理以下 Dim strAppendText As String
源代码网整理以下 "忽略特殊键
源代码网整理以下 Select Case e.KeyCode
源代码网整理以下 Case Keys.Back, Keys.Left, Keys.Right, Keys.Up, Keys.Down, Keys.Delete, Keys.CapsLock
源代码网整理以下 Return
源代码网整理以下 End Select
源代码网整理以下 "在查询列表中找到
源代码网整理以下 strTyped = Combo.Text
源代码网整理以下 intFoundIndex = Combo.FindString(strTyped)
源代码网整理以下 If intFoundIndex >= 0 Then
源代码网整理以下 objFoundItem = Combo.Items(intFoundIndex)
源代码网整理以下 strFoundText = Combo.GetItemText(objFoundItem)
源代码网整理以下 strAppendText = strFoundText.Substring(strTyped.Length)
源代码网整理以下 Combo.Text = strTyped & strAppendText
源代码网整理以下 Combo.SelectionStart = strTyped.Length
源代码网整理以下 Combo.SelectionLength = strAppendText.Length
源代码网整理以下 End If
源代码网整理以下 End Sub
源代码网整理以下 Private Sub AutoCompleteLeave(ByVal Combo As ComboBox)
源代码网整理以下 Dim intFoundIndex As Integer
源代码网整理以下 intFoundIndex = Combo.FindStringExact(Combo.Text)
源代码网整理以下 Combo.SelectedIndex = -1
源代码网整理以下 Combo.SelectedIndex = intFoundIndex
源代码网整理以下 End Sub
源代码网整理以下 Private Sub ComboBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ComboBox1.KeyUp
源代码网整理以下 AutoCompleteKeyUp(ComboBox1, e)
源代码网整理以下 End Sub
源代码网整理以下 Private Sub ComboBox1_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.Leave
源代码网整理以下 AutoCompleteLeave(ComboBox1)
源代码网整理以下 End Sub
|