简体   繁体   中英

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 ?

i got a link 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. But, you can access the corresponding DataRow using the Row property.

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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