找到树节点

2016-02-20 17:12:36  访问(2079) 赞(0) 踩(0)


        /// <summary>
        /// 找到树节点
        /// </summary>
        /// <param name="tnc"></param>
        /// <param name="vId"></param>
        /// <returns></returns>
        protected TreeNode TreeNodeFind
            (
                TreeNodeCollection tnc, 
                long vId
            )
        {
            if (tnc == null)
                return null;

            TreeNode theResult = null;
            string strId = vId.ToString();

            foreach (TreeNode tn in tnc)
            {
                if (tn == null)
                    continue;

                if (tn.Name == n_ + strId)
                    return tn;

                theResult = TreeNodeFind(tn.Nodes, vId);

                if (theResult != null)
                    return theResult;

            }

            return null;

        }


标签:找到树节点 

上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)
 
  ┈全部┈  
 
(显示默认分类)