Home >Backend Development >C#.Net Tutorial >Detailed explanation of the automatic prompt, automatic completion and automatic completion functions of the TextBox input box in c# (pictures and text)
Property value Type: System.Windows.Forms.AutoCompleteMode
One of the AutoCompleteMode values. These values are shown below.
Append
Appends the remainder of the most likely candidate string to the existing characters and highlights the appended characters.
Suggest
Display the auxiliary drop-down list associated with the edit control. This drop-down list is populated with one or more suggested completion strings.
SuggestAppend
Append Suggest and Append options.
None
Disable autocomplete This is the default value.
Use of the AutoCompleteCustomSource property is optional, but the AutoCompleteSource property must be set to CustomSource to use AutoCompleteCustomSource.
The AutoCompleteMode and AutoCompleteSource properties must be used together.
This example will do the following:
Use the AutoCompleteSource property to enable the TextBox control to accept a custom source for its autocomplete behavior.
Use the AutoCompleteCustomSource property to set a custom list of values.
Use the AutoCompleteMode property to set how autocomplete candidates are displayed.
private void Form1_Load(object sender, EventArgs e) { var source = new AutoCompleteStringCollection(); source.AddRange(new string[] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }); textBox1.AutoCompleteCustomSource = source; textBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend; textBox1.AutoCompleteSource = AutoCompleteSource.CustomSource; }
The above is the detailed content of Detailed explanation of the automatic prompt, automatic completion and automatic completion functions of the TextBox input box in c# (pictures and text). For more information, please follow other related articles on the PHP Chinese website!