首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

trending从2003迁移到2005不兼容的有关问题

2012-12-19 
trending从2003迁移到2005不兼容的问题程序运行后产生运行时错误,错误内容System.InvalidOperationExcepti

trending从2003迁移到2005不兼容的问题

程序运行后产生运行时错误,错误内容System.InvalidOperationException DragDrop registration did not succeed。

?

解决方法:

1、较简单的方法是将所有控件的AllowDrop属性置位为false.

2、按照下面来操作:

1) include the following
using System.Net;
using System.Threading;

2) add the [STAThread] Attribute just before ur main function? and also remember to inlcude using System.Net; in ur main program,

[STAThread]
?static void Main()

3) The steps are as follows for threading,

1. Put all the code ( for which u r getting this exception) in one function say function A. In the function B in which u are calling ur code,do the following,
function B
{
???? ??? ?? Thread t = new Thread(new ThreadStart(A));
??????????? t.SetApartmentState(ApartmentState.STA);
??????????? t.Start( );???
}
function A
{
?the code of Windows form..or whatever which is causing the error
}

热点排行