TextBox AutoComplete Not working properly

后端 未结 5 532
天涯浪人
天涯浪人 2021-01-20 14:29

I am trying to implement a textbox autocomplete with a custom datasource in the form of an array which shows suggestions on single character input. But when i run the progra

5条回答
  •  悲&欢浪女
    2021-01-20 14:50

    On load you may populate the TextBox with a sub-set of your data (that can be even cached for future/shared use). If you have a "most common" counter you can use it. As limit condition you may even add a dummy item (if what you get with an empty string is an access violation). Then, on the TextChange event read the data you need from the database.

    I have only one question: you do not want to populate the source until the user starts to type? If there's the problem of network traffic then you move a lot of data. If you move a lot of data then your users will have to wait when they start to type something. Is it acceptable? On the other side if they do not wait too much maybe data stream is not so big and you can put that logic in a BackgroundWorker in the constructor of your form (or not far from that time).

提交回复
热议问题