AutoComplete Texbox error - write to protected memory

前端 未结 2 1770
情书的邮戳
情书的邮戳 2021-01-22 07:00

I have an autocompleate textbox that looks into a data base. Some times while I\'m typing I received the following error.

Attempted to read or write protected memory

2条回答
  •  执笔经年
    2021-01-22 07:39

    It is a bug in Windows Forms's wrapper of autocomplete APIs. Windows Forms does not protect the AutoCompleteCustomSource object from being replaced while it is being enumerated by a background thread created by autocomplete.

    Instead of replacing the data store, you can try replace the autocomplete object or use the IAutoCompleteDropDown interface to reset the enumerator.

提交回复
热议问题