Your problem, I suppose, is in the method
btnFind_Click()
. You're declaring an object of type
TreeNode
, eventually assigning something to it. But then, the method exits and therefore throws away your precious TreeNode instead of displaying it.
Put the displaying code here:
private void btnFind_Click(object sender, EventArgs e)
{
TreeNode itemNode = null;
foreach (TreeNode node in tvMenu.Nodes)
{
itemNode = FromID(tbSearch.Text, node);
if (itemNode != null) break;
}
if( itemNode != null)
{
DisplayTreeNodeInfo(ItemNode);
}
}
Of course, You will have to write a method
DisplayTreeNodeInfo()
suitable exactly for your needs.