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
}