错误:尝试读取或写入受保护的内存。这通常指示其他内存已损坏。 winform下textbox实现智能提示后 出现RT错误!请遇到过此问题的朋友指点一下怎么解决 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 未处理 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() 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 在 System.Threading.ThreadHelper.ThreadStart() 八成在线程里直接访问控件 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 未处理 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: C#怎样动态调用COM组件 讨论一下,我认为c#最关键要掌握的几项技术 对用户输入的算式得出结果 C# 求助 怎么用c#拷贝一段XML然后粘贴到它的下面。是下面~ 急需Winform下Sql导出Excel,在几万条数据时只需要几秒钟的代码来 如何通过编程的方式更改IE的proxy设置? VSTO开发,如何在Word上实现随手涂鸦这个功能?? 遗憾。小弟前几天恨了恨心花五十五大元买了一套Visual Studio .net,想爽一爽,可惜。。。 用C#打开Access数据库? 连数据库的问题,有点难度 未将对象引用到实例
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()
在 System.Threading.ThreadHelper.ThreadStart() 八成在线程里直接访问控件
{
#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
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: