这是什么错误怎么解决呢 [英] What is this error how to solve this

查看:63
本文介绍了这是什么错误怎么解决呢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何解决此错误...
帮助
无法从"System.Web.UI.WebControls.GridView"转换为"System.Windows.Forms.DataGridView

How to solve this error...
help
cannot convert from ''System.Web.UI.WebControls.GridView to ''System.Windows.Forms.DataGridView

推荐答案

将值赋给无法保存的变量.在这种情况下,您尝试将GridView加载到DataGridView中-它们是非常不同的类,并且不相关.

没有相关的代码片段,我将无能为力.
The message is pretty clear: You are trying to assign a value to a variable that is not capable of holding it. In this case, you are trying to load a GridView into a DataGridView - they are very different classes and not related.

Without the relevant code fragment, there isn''t a lot more I can do...


您无法将webcontrol转换为Windows窗体控件.若要解决此问题,请在Web应用程序中引用webcontrol,并在Windows应用程序中引用windows控件.请参见下面的命名空间差异.

''System. Web.UI.WebControls .GridView到''System .Windows.Forms. DataGridView
You cannot convert webcontrol to windows form control. To resolve this refer webcontrol in web application and refer windows control in windows application. see the highligted difference of namespaces below.

''System.Web.UI.WebControls.GridView to ''System.Windows.Forms.DataGridView


答案已在您的错误消息...我想您打算将webControls GridView分配给Windows窗体DataGridView.这些是非常不同的对象,无法进行这种转换...
为什么不尝试分配数据源 ...
如果有一种方法可以将数据加载到Windows窗体DataGridView.您可以像下面这样分配它
Answer is already in your error message...I think your going to assign webControls GridView to windows form DataGridView. Those are very different objects and this kind conversion is cannot be done...
Why don''t you try assign Data Source...
If there is a way to load data to your Windows form DataGridView.You can assign it like below
Web.UI.WebControls.GridView gV = new Web.UI.WebControls.GridView();

gV.DataSource= dataTableObject; // data table object



您可以将 System.Windows.Forms.DataGridView 数据源分配给该数据表对象



you can assign your System.Windows.Forms.DataGridView data source to this data table object


这篇关于这是什么错误怎么解决呢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆