Sarvesh
Sarvesh

Reputation: 181

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

Upvotes: 16

Views: 43180

Answers (3)

Marcos Gonzalez
Marcos Gonzalez

Reputation: 21

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;

Upvotes: 2

Rayan Elmakki
Rayan Elmakki

Reputation: 1194

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

Upvotes: 10

munissor
munissor

Reputation: 3785

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

Upvotes: 51

Related Questions