1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
TreeNode FindNode (TreeNodeCollection tncoll, String strText)
{
TreeNode tnFound;
foreach (TreeNode tnCurr in tncoll) {
if (tnCurr.Text.StartsWith (strText)) {
return tnCurr;
}
tnFound = FindNode (tnCurr.Nodes, strText);
if (tnFound != null) {
return tnFound;
}
}
return null;
}
// Beispielaufruf
void SearchTextChanged (Object objSender, EventArgs ea)
{
_tvDir.SelectedNode = FindNode (_tvDir.Nodes, _tbxSearch.Text);
}
|