How can Convert DataRowView To DataRow in C#

2020-08-10 07:54发布

I want to use Drag Drop But i don't know How to drag information from a DataGridView control to DataGridView or ListBox ?

i got a link http://www.codeproject.com/KB/cpp/DataGridView_Drag-n-Drop.aspx

标签: c#
3条回答
劫难
2楼-- · 2020-08-10 08:41

DataRowView.Row should contain the DataRow displayed in the view.

查看更多
来,给爷笑一个
3楼-- · 2020-08-10 08:41

A DataRowView is not a DataRow, and isn't convertible to a DataRow. But, you can access the corresponding DataRow using the Row property.

查看更多
看我几分像从前
4楼-- · 2020-08-10 08:41

here i've got the solution using the narrow casting

The name of the combobox in this example is CBTables

 DataRowView DRV = (DataRowView)CBTables.SelectedItem;
 DataRow DR = (DataRow) DRV.Row;
查看更多
登录 后发表回答