Torna al Thread
Public Class CBcustom
Inherits ComboBox
Dim pCBtasti As New List(Of Keys)
''' <summary>
''' Aggiunge un tasto che non chiude
''' la DopDownList
''' </summary>
''' <param name="Tasto">Keys.ecc</param>
Public Sub TastoAdd(ByVal Tasto As Keys)
pCBtasti.Add(Tasto)
End Sub
''' <summary>
''' Rimuove un tasto che non chiude
''' la DopDownList
''' </summary>
''' <param name="Tasto">Keys.ecc</param>
Public Sub TastoRemove(ByVal Tasto As Keys)
pCBtasti.Remove(Tasto)
End Sub
Sub New()
Me.DropDownStyle = ComboBoxStyle.DropDown
Me.AutoCompleteMode = AutoCompleteMode.Suggest
Me.AutoCompleteSource = AutoCompleteSource.ListItems
End Sub
Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean
If pCBtasti.Contains(keyData) = False Then
Me.DroppedDown = False
End If
Return MyBase.ProcessCmdKey(msg, keyData)
End Function
Private Sub mostraDPList() Handles Me.TextChanged
If Me.Focused Then
If Me.Text = "" Then
Me.DroppedDown = True
End If
End If
End Sub
End Class