Hi
Below is a code for a combobox which acts like the comboboxes in Access. But
now when I'm using the combobxes event KeyUp to get this action, I don't
wan't programmers who uses this comboboxes to be able to use the event KeyUp
for their own code. Should I use shadows or is there a better way? I'm not
sure what Shadows really does. I would prefere that when a programmer uses
this combobox and looking at the comboboxes events in the event list, the
KeyUp wouldn't be in the event list. Is that possible to achieve.
Public Class IntelliCmb
Inherits System.Windows.Forms.ComboBox
Public Shadows Event KeyUp(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs)
Private Sub IntelliCombo_KeyUp(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp
Dim index As Integer
Dim actual As String
Dim found As String
' Do nothing for certain keys such as navigation keys
If ((e.KeyCode = Keys.Back) Or _
(e.KeyCode = Keys.Left) Or _
(e.KeyCode = Keys.Right) Or _
(e.KeyCode = Keys.Up) Or _
(e.KeyCode = Keys.Delete) Or _
(e.KeyCode = Keys.Down) Or _
(e.KeyCode = Keys.PageUp) Or _
(e.KeyCode = Keys.PageDown) Or _
(e.KeyCode = Keys.Home) Or _
(e.KeyCode = Keys.ShiftKey) Or _
(e.KeyCode = Keys.End)) Then
Return
End If
' Store the actual text that has been typed
actual = Text
' Find the first match for the typed value
index = FindString(actual)
' Get the text of the first match
If (index > -1) Then
found = Items(index).ToString()
' Select this item from the list
SelectedIndex = index
' Select the portion of the text that was automatically
' added so further typing will replace it
SelectionStart = actual.Length
SelectionLength = found.Length
End If
End Sub
End Class
Thank's
Fia