简体   繁体   English

如何在C#中将DataRowView转换为DataRow

[英]How can Convert DataRowView To DataRow in C#

I want to use Drag Drop But i don't know How to drag information from a DataGridView control to DataGridView or ListBox ? 我想使用Drag Drop但我不知道如何将信息从DataGridView控件拖到DataGridView或ListBox?

i got a link http://www.codeproject.com/KB/cpp/DataGridView_Drag-n-Drop.aspx 我有一个链接http://www.codeproject.com/KB/cpp/DataGridView_Drag-n-Drop.aspx

DataRowView.Row应包含视图中显示的DataRow。

A DataRowView is not a DataRow , and isn't convertible to a DataRow. DataRowView不是DataRow ,也不能转换为DataRow。 But, you can access the corresponding DataRow using the Row property. 但是,您可以使用Row属性访问相应的DataRow。

here i've got the solution using the narrow casting 在这里,我得到了使用窄铸件的解决方案

The name of the combobox in this example is CBTables 此示例中的组合框的名称是CBTables

 DataRowView DRV = (DataRowView)CBTables.SelectedItem;
 DataRow DR = (DataRow) DRV.Row;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM