I have encountered someone on the Internet to ask questions about the automatic filling of ComboBox. Of course, I didn't care, who I learned later because software development needs to encounter the same problem. So I have to find information everywhere, who knows the only functionality that can only be automatically filled, and does not touch the same information like IE column, which can expand ComboBox and highlight the content. (Accent, there is 3 days of record under ComboBox, respectively: eqweq, fasdfs, tyr "When I enter the character e, I should display EQWEQ in the text box and expand the pull box, select EQWEQ). Warm, I have to do this After study, after a slight change, the function I expected, the source code is as follows:
using System; using System.Collections; using System.ComponentModel; using System.Drawing; using System.Data; using System.Text; using System.Windows.Forms; namespace DigitalCult {///
(ACCOMBOBOX) Sender; if (! 8)) {searchitems (AccomboBox, Ref e);} else e.handled = false;} else e.handled = false;} /// < Summary> /// Searches the Commary> /// Searches the Commary> /////// summary> ///// Private void SearchItems (aCComboBox acComboBox, ref KeyPressEventArgs e) {int selectionStart = acComboBox.SelectionStart; int selectionLength = acComboBox.SelectionLength; int selectionEnd = selectionStart selectionLength; int index; StringBuilder sb = new StringBuilder (); sb.Append (acComboBox.Text. Substring (0, selectStart) .append (E.keychar.tostring ()) .append (accomboBox.tex t.Substring (selectionEnd)); index = acComboBox.FindString (sb.ToString ()); if (index == -1) e.Handled = false; else {acComboBox.SelectedIndex = index; acComboBox.Select (selectionStart 1 AccomboBox.Text.Length- (SelectionStart 1)); E.Handled = true;}} #Region Component Designer generated code ///