[英]How to move selected item from one listview to another in C#?
我在我的列表视图上使用FullRowSelect = true,如何将一种形式的列表视图项转移到具有列表视图的另一种形式。
on form1
, create a ListViewItem
as 在
form1
,创建一个ListViewItem
作为
ListViewItem lstItem = listView1.SelectedItems[0];
on form2
, create a parameterized constructor as 在
form2
,创建一个参数化的构造函数为
ListViewItem lstViewItem = new ListViewItem(); //global variable
public Form2(ListViewItem lstItem)
{
InitializeComponent();
lstViewItem = lstItem;
}
call form2
from form1
with ListViewItem
as 使用
ListViewItem
从form1
调用form2
Form2 frm = new Form2(lstItem);
frm.Show();
so on form2
you can get ListViewItem
which was selected and pass through form1
因此在
form2
您可以获得选择的ListViewItem
并通过form1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.