People who have used ie should be familiar with Automatic completion. It can help users quickly enter the content they have already entered,
Chart 1 IE is automatically completed
In the past, someone asked, "Is Automatic completion feasible in Windows form ?" The answer is not available in. NET Framework 1.x and needs to be developed by the user. This function has been built in. NET Framework 2.0. This article describes how to automatically complete windows form in. NET Framework 2.0.
Automatic completion attributes:
Textbox, ComboBox… in Windows form... Controls such as text boxes support Automatic completion of attributes. With these attributes, you can specify different forms of Automatic completion:
Autocompletemode attribute
Specify the Automatic completion mode. You can set the none, suggest, append, and suggestappend modes. The default value is none. Auto completion mode is not used. When it is set to append mode, the text in the data source is automatically added to the box after the input. (Figure 2) When suggestappend is set to suggestappend mode, the information is not automatically filled, but a list is displayed for users to choose from (Figure 3)
Chart 2 append Chart 3 suggestappend
Autocompletesource attributes:
Set the source of the automatically completed data. You can set none, allsystemsource, allurl, customsource, filesystem, filesystemdirectories, filesystem, filesystemdirectories, historylist, and recentlyusedlist.
Autocompletecustomsource attribute
When the autocompletesource attribute is set to customsource, you can use this attribute to customize automatic string completion.
Custom Source
To meet more non-document or URL requirements, the autocompletesource attribute provides the customsource option for developers to specify more data sources through the autocompletecustomsource attribute to meet more types of requirements.
The autocompletecustomsource attribute is the form of autocompletestringcollection. The ADD and addrange methods are supported to add the required strings, for example:
VB. NET Dim member () as string = {"one", "two "} Textbox2.autocompletecustomsource. addrange (member) |
The solution for automatically completing the list is not added to the newly entered materials.
The add () method is required, and the system does not automatically add
End the program and start it again. Why is the previous automatic Completion list missing?
After the program is started, you will find that the list you added earlier is missing? Yes, that's because the previous data (automatically completed string set) is only stored in the memory. When the application ends, the data in the memory disappears, the solution is to archive the data in the memory. Of course there are many methods. You can use filestream streamwriter. Here, we recommend that you use the function set by the Windows application (that is, the app. config) there is a special autocompletestringcollection type available for storage. For more information about the methods, see msdn.
Conclusion
Windows form in. NET 2.0 finally has the Automatic completion function, this function can be applied to Textbox, ComboBox and other text input class control items, with the application settings, can achieve a more complete function.