C# DragDrop 注册失败 的处理方法之一
来源:互联网 发布:乐视电视软件 编辑:程序博客网 时间:2024/05/22 03:45
System.InvalidOperationException: DragDrop 注册失败。 ---> System.Threading.ThreadStateException: 在可以调用 OLE 之前,必须将当前线程设置为单线程单元(STA)模式。请确保您的 Main 函数带有 STAThreadAttribute 标记。
在 System.Windows.Forms.Control.SetAcceptDrops(Boolean accept)--- 内部异常堆栈跟踪的结尾 ---
在 System.Windows.Forms.Control.SetAcceptDrops(Boolean accept)
在 System.Windows.Forms.Control.OnHandleCreated(EventArgs e)
在 System.Windows.Forms.DataGridView.OnHandleCreated(EventArgs e)
在 System.Windows.Forms.Control.WmCreate(Message& m)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.DataGridView.WndProc(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
网上找了一圈,试了所有的方法,都不能解决我这个问题,于是静下心来,仔细查看异常堆栈信息,发现异常是从DataGridView中传出来的,结合.SetAcceptDrops失败,可以知道该问题与DataGridView中的相关属性有关, 于是查一下属性,发现AllowDrop为true,改为false,再次运行,异常清除。
- C# DragDrop 注册失败 的处理方法之一
- DragDrop 注册失败的解决方法
- 多线程时DragDrop 注册失败的问题
- [.Net码农]DragDrop 注册失败的问题
- DragDrop 注册失败的解决方法(详细,经过测试)
- DragDrop 注册失败的解决方法(详细,经过测试)
- DragDrop 注册失败的解决方法(详细,经过测试)
- DragDrop 注册失败的解决方法(详细,经过测试)
- DragDrop 注册失败的解决方法(详细,经过测试)
- C#:修改程序集信息后DragDrop注册失败
- 设备注册失败的处理
- 注册控件失败之一:提示0x80040200错误的处理办法
- C#学习-C#中对DragDrop、DragEnter两个事件处理
- ASP.NET 后台注册JS失败的原因之一
- 关于使用Adobe Flash CS4注册码注册失败的应急处理方法
- C# ListView添加DragDrop
- 解决DLL注册失败的方法
- new失败的处理方法
- mtd----------嵌入式-------------------
- Flex学习资料
- 笨木头的跑跑跑笔记六 添加障碍物,添加图层
- 如何删除 CentOS 6 更新后产生的多余的内核
- display:none与visible:hidden的区别
- C# DragDrop 注册失败 的处理方法之一
- MFC获取本机IP的方法
- 禁用mac pro 触模板
- xheditor文字编辑器(jquery)
- 笨木头的跑跑跑笔记七 制造能吃的点心~~哈,完结
- js正则校验
- ultraedit常用设置
- jsp中param标签的使用
- 链接hdf5库出现错误的解决办法