【Winform】 无法将类型为“System.Windows.Forms.SplitContainer”的对象强制转换为类型“System.ComponentModel.ISupportInitialize”。

问题:将dotnet framework 4.0 切换到2.0时,编译没有问题,在运行时出现如下错误:System.InvalidCastException: 无法将类型为“System.Windows.Forms.SplitContainer”的对象强制转换为类型“System.ComponentModel.ISupportInitialize”。

解决方法:

注释掉如下代码(此代码为设计器自动生成代码)

 

//((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
  //((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();

 

【参考文献】点击进入

 

文章来自:http://www.cnblogs.com/mzy-google/p/4374014.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3