/home/wpollock1/public_html/VB/ComboBoxDemoForm.vb
' Demo of some ComboBox features:
' AutoCompleteMode = Append
' AutoCompletesource = ListItems
' IntegralHeight = False
' MaxDropDownItems = 8
' Initial Items collection = { "one", "two", "three", "four", "five", "six" }
'
' Written 3/2010 by Wayne Pollock, Tampa Florida USA
Public Class ComboBoxDemoForm
' This code intercepts the Enter key on the ComboBox, and addes
' the user-entered item to the list if it isn't already there:
Private Sub ComboBox1_KeyDown(ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) _
Handles ComboBox1.KeyDown
If e.KeyCode = Keys.Return Then
Dim newItem As String = ComboBox1.Text
If Not ComboBox1.Items.Contains(newItem) Then
ComboBox1.Items.Add(ComboBox1.Text)
End If
End If
End Sub
End Class