我已经加入我的窗体上的文本框,并在TextChanged事件我写了下面的代码,以便AutoCompleteSource:AccessViolationException未处理
private void txtNameCostBL_TextChanged(object sender, EventArgs e)
{
txtNameCostBL.AutoCompleteMode = AutoCompleteMode.Suggest;
txtNameCostBL.AutoCompleteSource = AutoCompleteSource.CustomSource;
AutoCompleteStringCollection col = new
AutoCompleteStringCollection();
for (int i = 0; i < dtCustomerForSalesBl.Rows.Count; i++)
{
col.Add(dtCustomerForSalesBl.Rows[i][1].ToString());
}
txtNameCostBL.AutoCompleteCustomSource = col;
}
它工作正常,但有时当我书面方式的东西它会引发图像上显示的AccessViolation。
我希望你能给我一个解决方案。
感谢
亲爱@Thread你能你的问题翻译成英文吗?这个平台是完全英文的,大多数程序员用英文编程。 (因为你的代码也是英文的) –
投票结束不清楚你问的问题:请澄清你的具体问题或添加额外的细节,以确切地突出你需要什么。正如现在写的那样,*很难确切地告诉你要问什么*。 – Reniuz
你可能只能从UI线程更新UI(就我的应用程序知识而言)? –