Autocomplete VB.NET
-
I am running a process card that has multi-users. Functionality would be to have an autocomplete box in the "dropdownlist" utility. Despite my attempts I am unable to have a keychange event used in the box. This is the code I use for a combo box to autocomplete, but as my problem is in a dropdownlist, it does not allow me to use a keypress event. Private Sub ComboBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles ComboBox1.KeyPress If Char.IsControl(e.KeyChar) Then Return With Me.ComboBox1 Dim ToFind As String = .Text.Substring(0, .SelectionStart) & e.KeyChar Dim Index As Integer = .FindStringExact(ToFind) If Index = -1 Then Index = .FindString(ToFind) If Index = -1 Then Return .SelectedIndex = Index .SelectionStart = ToFind.Length .SelectionLength = .Text.Length - .SelectionStart e.Handled = True End With End Sub Please help with any method used to create a keypress event creator. Regards, Nicholas
-
I am running a process card that has multi-users. Functionality would be to have an autocomplete box in the "dropdownlist" utility. Despite my attempts I am unable to have a keychange event used in the box. This is the code I use for a combo box to autocomplete, but as my problem is in a dropdownlist, it does not allow me to use a keypress event. Private Sub ComboBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles ComboBox1.KeyPress If Char.IsControl(e.KeyChar) Then Return With Me.ComboBox1 Dim ToFind As String = .Text.Substring(0, .SelectionStart) & e.KeyChar Dim Index As Integer = .FindStringExact(ToFind) If Index = -1 Then Index = .FindString(ToFind) If Index = -1 Then Return .SelectedIndex = Index .SelectionStart = ToFind.Length .SelectionLength = .Text.Length - .SelectionStart e.Handled = True End With End Sub Please help with any method used to create a keypress event creator. Regards, Nicholas
Look around on this site, if you haven't already. There are several articles about AutoComplete functionality...
If you try to write that in English, I might be able to understand more than a fraction of it. - Guffa