110,537
社区成员
发帖
与我相关
我的任务
分享
private TreeNode fun_FindNode(TreeNode tnParent, string strValue, TreeNode tnc)
{
//遍历TV
if (tnParent == null)
return null;
if (tnParent.Tag.ToString() == strValue)
{
tnParent.Nodes.Add(tnc);//这里改成treeview1.SelectedNode = tnParent;
return tnParent;
}
TreeNode tnRet = null;
foreach (TreeNode tn in tnParent.Nodes)
{
tnRet = fun_FindNode(tn, strValue, tnc);
if (tnRet != null)
{
break;
}
}
return tnRet;
}