winform下
textbox实现智能提示后 出现RT错误!请遇到过此问题的朋友指点一下怎么解决

解决方案 »

  1.   

    未处理 System.AccessViolationException
      Message="尝试读取或写入受保护的内存。这通常指示其他内存已损坏。"
      Source="System.Windows.Forms"
      StackTrace:
           在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
           在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
           在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
           在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
           在 System.Windows.Forms.Application.Run(Form mainForm)
           在 BeforeHandBuy.Program.Main() 位置 D:\c#Projects\BeforeHandBuy\BeforeHandBuy\Program.cs:行号 18
           在 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
           在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           在 System.Threading.ThreadHelper.ThreadStart()
      

  2.   

          在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
          在 System.Threading.ThreadHelper.ThreadStart() 八成在线程里直接访问控件
      

  3.   

    private void BuyMainForm_Load(object sender, EventArgs e)
            {
                #region 创建项目的智能提示
                this.Batch_NoBBX.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
                this.Batch_NoBBX.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
                this.Batch_NoBBX.AutoCompleteCustomSource = ac;
                #endregion            this.ItemNoteComBE.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
                this.ItemNoteComBE.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
                this.ItemNoteComBE.AutoCompleteCustomSource = ac;        }
            #region 器件名称的智能提示
            private void Batch_NoBBX_TextChanged(object sender, EventArgs e)
            {
                string batch_no = Batch_NoBBX.Text.ToUpper().Trim();
                DataSet ds = new DataSet();
                string err = "";
                DataTable dt = new DataTable();
                if (!SelectForBeforeHandBuy.SelectBatch_no(batch_no, ref ds, out err))
                {
                    MessageBox.Show(err, "提示");
                }
                else
                {
                    dt = ds.Tables[0];
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        ac.Add(dt.Rows[i][0].ToString());
                    }
                }        }
            #endregion
      

  4.   

    未处理 System.AccessViolationException
      Message="尝试读取或写入受保护的内存。这通常指示其他内存已损坏。"
      Source="System.Windows.Forms"
      StackTrace:
           在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
           在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
           在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
           在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
           在 System.Windows.Forms.Application.Run(Form mainForm)
           在 demo.Program.Main() 位置 D:\My Documents\Visual Studio 2008\Projects\demo\demo\Program.cs:行号 18
           在 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
           在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           在 System.Threading.ThreadHelper.ThreadStart()
      InnerException: