System.Windows.Forms.TreeView.SelectNodeWText C# (CSharp) Method

SelectNodeWText() protected method

protected SelectNodeWText ( string text, bool caseSencitive = false ) : void
text string
caseSencitive bool
return void
        protected void SelectNodeWText(string text, bool caseSencitive = false)
        {
            string lowerText = text;
            if (caseSencitive == false) lowerText = text.ToLower();

            for (int i = 0; i < _nodeList.Count; i++)
            {
                var node = _nodeList[i];
                string nodeText = node.Text;
                if (nodeText.Length < text.Length) continue;

                string clippedNodeText = nodeText.Substring(0, text.Length);
                if (caseSencitive == false) clippedNodeText = clippedNodeText.ToLower();

                if (clippedNodeText == lowerText)
                {
                    EnsureVisible(node);
                    _SelectNode(node);
                    break;
                }
            }
        }