如何将特定的列表视图行添​​加到另一个窗体上的另一个列表视图

时间:2019-11-03 14:00:02

标签: c#

如果我从form1中选择一个列表视图行,我希望将form1行中的“一些”数据放置在form2列表视图中

Form 1代码:


private void StandardUserListView_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            ViewUserDetail vud = new ViewUserDetail(StandardUserListView.SelectedItems[0].SubItems[1].Text, StandardUserListView.SelectedItems[0].SubItems[2].Text, StandardUserListView.SelectedItems[0].SubItems[3].Text, StandardUserListView.SelectedItems[0].SubItems[4].Text);
            vud.ShowDialog();


        }

Form 2代码:


        public ViewUser vu;

private void ViewUserDetail_Shown(object sender, EventArgs e)
        {
            ScheduleListView.Items[0].SubItems[0].Text = vu.StandardUserListView.SelectedItems[0].SubItems[0].Text.ToString();
            ScheduleListView.Items[0].SubItems[1].Text = vu.StandardUserListView.SelectedItems[0].SubItems[1].Text.ToString();

        }

0 个答案:

没有答案