ネットワークで動作する Windows ベース プログラムを作成しました。
最初に、データベースから名前を読み取り、入力した文字に従ってユーザーに表示するオートコンプリートテキストボックスがありました。
プログラムは正常に動作していましたが、時々エラーが発生しました
しかし
今、データベースから読み取る別のオートコンプリート テキスト ボックスを追加しました。最初のオートコンプリートは正常に機能しますが、2 番目のテキスト ボックスに入力しようとすると、このエラーが表示されてフリーズします。
興味深い点は、プログラムがサーバー上で適切に動作し、クライアント上でのみこのエラーが表示されることです。ラップトップまたは他のラップトップで実行してもエラーは発生しませんが、自宅のラップトップでネットワークを作成しましたが、オフィスのクライアントコンピューターでのみエラーが発生します。
この問題を解決するのを手伝ってください。
ありがとうございました
完全な例外の内容は次のとおりです。
-----Exception Type Is : UnHandled
-----Exceptiotn Message is : Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
-----Source that causes this error: System.Windows.Forms
-----StackTrace is : at System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32 reason,ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason,ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Project1.Program.Main() in C:\Users\ZY\Documents\Visual Studio 2008\Projects\Project1\Project1\Program.cs:line 25
私のオートコンプリートコードは次のとおりです。
private void txtkhrdsharh_TextChanged(object sender, EventArgs e)
{
AutoCompleteStringCollection namecollection = new AutoCompleteStringCollection();
BLL objbll = new BLL();
SqlDataReader rea = objbll.SelectSharhlistF(txtkhrdsharh.Text);
if (rea.HasRows == true)
{
while (rea.Read())
namecollection.Add(rea["sharh"].ToString());
}
rea.Close();
txtkhrdsharh.AutoCompleteMode = AutoCompleteMode.Suggest;
txtkhrdsharh.AutoCompleteSource = AutoCompleteSource.CustomSource;
txtkhrdsharh.AutoCompleteCustomSource = namecollection;
}