private void FindNodeInHierarchy(TreeNodeCollection nodes, string strSearchValue) { // Boolean m_bNodeFound = false; for (int iCount = 0; iCount < nodes.Count; iCount++) { if (nodes[iCount].Text.ToUpper().Contains(strSearchValue.ToUpper())) { TVICD10.SelectedNode = nodes[iCount]; TVICD10.Select(); //m_bNodeFound = true; return; } else { // m_bNodeFound = false; } //nodes[iCount].Expand(); ////Recursively search the text in the child nodes //FindNodeInHierarchy(nodes[iCount].Nodes, strSearchValue); //if (m_bNodeFound) //{ // return; //} ////collapses the nodes //nodes[iCount].Collapse(); ////return; } }
private void FindNodeInHierarchy(TreeNodeCollection nodes, string strSearchValue) { Boolean m_bNodeFound = false; for (int iCount = 0; iCount < nodes.Count; iCount++) { if (nodes[iCount].Text.ToUpper().Contains(strSearchValue.ToUpper())) { TVICD10.SelectedNode = nodes[iCount]; TVICD10.Select(); m_bNodeFound = true; return; } else { m_bNodeFound = false; } } }