C # WinForm TextBox conjecture input and history input (source code)

Source: Internet
Author: User

 

What is conjecture input?

When we use a query application, the phrase associated with this keyword is automatically displayed under the text box after a keyword is entered for selection, saving us time for input, this is the hypothetical input, such as Baidu, Google, and so on, such:

 

 

As shown in, this effect is achieved by using TextBox of WinForm, mainly by using the AutoCompleteMode, AutoCompleteSource, and AutoCompleteCustomSource attributes of TextBox.

 

Detailed Parameters

 

AutoCompleteMode

Gets or sets the option that controls how TextBox is automatically completed.

Attribute Value

Append the remaining parts of the most likely candidate string to an existing character and highlight the appended characters.

Suggest displays the secondary drop-down list associated with the editing control. This drop-down list is filled with one or more recommended completion strings.

SuggestAppend: Append the Suggest and Append options.

None disable auto-completion. This is the default value.

 

AutoCompleteSource gets or sets a value that specifies the source of the complete string that is automatically completed.

AutoCompleteCustomSource gets or sets the custom System. Collections. Specialized. StringCollection used when the AutoCompleteSource attribute is set to CustomSource.

 

For example:

 

 

Code Design

TextBoxRemind

Expand source

History

Because all data is stored, the system automatically creates a remind.txt file, which is easy to operate and easy to store.

When loading the form, initialize InitAutoCompleteCustomSource and add AutoCompleteStringCollection. When we click OK, reinitialize the data source and load the previously entered keywords.

Expand source

  

Last

We often encounter that Chinese characters cannot be normally displayed when StreamReader and StreamWriter are used. A simple method is to set Encoding to Default.

 

Attached http://www.bkjia.com/uploadfile/2011/1207/20111207052029104.zip

 

From aidong

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.