C#textbox input box automatic prompt, automatic completion, automatic complement full function __c#

Source: Internet
Author: User
Features Overview

related Properties Textbox.autocompletecustomsource Property

Gets or sets the custom t:system.collections.specialized.stringcollection to use when the Textbox.autocompletesource property is set to [CustomSource]. Textbox.autocompletemode Property

Gets or sets an option that controls how automatic completion applies to the TextBox.
Property Value
Type: System.Windows.Forms.AutoCompleteMode
One of the AutoCompleteMode values. The following are the values.
Append
Appends the remainder of the most likely candidate string to an existing character and highlights the appended characters.
Suggest
Displays the secondary Drop-down list associated with the edit control. This drop-down list populates one or more of the recommended completion strings.
SuggestAppend
Append suggest and Append options.
None
Disable automatic completion This is the default value. Textbox.autocompletesource Property

Gets or sets a value that specifies the source of the complete string used for automatic completion. Notes

You can create a TextBox by using the AutoCompleteCustomSource, AutoCompleteMode, and AutoCompleteSource properties. It automatically completes the input string by comparing the prefix entered with the prefix of all the strings in the source being maintained. This is useful for a TextBox control that frequently has a URL, address, file name, or command entry.
The use of the AutoCompleteCustomSource property is optional, but you must set the AutoCompleteSource property to CustomSource before you can use AutoCompleteCustomSource.
The AutoCompleteMode and AutoCompleteSource properties must be used together. Sample Code

The following code example demonstrates how to use a collection of AutoComplete custom sources as a TextBox control.
This example performs the following actions:
Use the AutoCompleteSource property to enable the TextBox control to accept custom sources for its AutoComplete behavior.
Use the AutoCompleteCustomSource property to set a custom list of values.
Use the AutoCompleteMode property to set how candidates are automatically 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;
        }
Source Download

C#textbox input box automatic prompt, automatic completion, automatic complement full function

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.