我的C#项目(WinApplication)存在问题。我无法将所选节点从treeview填充到listview。我怎么能这样做呢; 这就是我到目前为止所做的:
List<TreeNode>checked_tree_nodes=new List<TreeNode>();
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
if (e.Action != TreeViewAction.Unknown)
{
if (e.Node.Nodes.Count > 0)
{
unchecknodes(e.Node, e.Node.Checked);
}
}
if (e.Action != TreeViewAction.Unknown)
{
if (e.Node.Nodes.Count > 0)
{
checknodes(e.Node, e.Node.Checked);
}
}
foreach (TreeNode trl in checked_tree_nodes)
{
string text = "";
ListViewItem lv = listView1.FindItemWithText(text);
ListViewItem lvi = new ListViewItem(ypoxrewseis[treeView1.SelectedNode.Index].name);
lvi.SubItems.Add(task[treeView1.SelectedNode.Index].type); lvi.SubItems.Add(task[treeView1.SelectedNode.Index].date.ToString());
if (lv == null)
{
listView1.Items.Add(lvi);
}
else
{
MessageBox.Show("Exists!");
}
}
}
提前致谢!