Is it possible to transfer a row or multiple rows from listview to datagrdiview?. If yes than provide some code.
Suppose Listview1 having 7 columns and multiple rows where as开发者_开发百科 the datagridview1 also having 7 columns.
If I wants to move a selected rows of listview1 with 7 columns's rows to datagridview than how to do?.
Sure. Assume you have a Winform with a ListView named listView1 and a DataGridView with no columns named dataGridView1 run this:
dataGridView1.Columns.Clear();
dataGridView1.Columns.Add("SelectedItemCol", "Selected Items");
foreach (ListViewItem item in listView1.SelectedItems) {
dataGridView1.Rows.Add(item.Text);
}
精彩评论