via_point
via_point

Reputation: 2723

How and where to insert selected rows from DataGridView?

I need to transfer selected rows from DataGridView in one form to another. The questions are: what control is better to use in the second form and how do I transfer my data? Thank you.

Upvotes: 1

Views: 303

Answers (2)

Sorrel Vesper
Sorrel Vesper

Reputation: 414

If I understand your requirement correctly, you want to transfer data between two pages? Or is it forms?

If you had only ID and Description as columns, you could then use two Listboxs as source and destination.

If you don't want to use the listboxes, then you should do the following:

If it is between controls in same page, then use two gridviews, one as source and other as destination. Use Datatables to get the rows and insert them in datatables and then put these in Sessions. If you need further guidance, let me know.

Upvotes: 1

Mamta D
Mamta D

Reputation: 6450

Another DataGridView would be an apt choice. To transfer the rows, you could use any of these: DataSet object, DataTable object, a collection, and so forth.

Upvotes: 2

Related Questions