void FtpDirTree_BeforeExpand(object sender, TreeViewCancelEventArgs e) { TreeNode node = e.Node; Cursor wasCursor = null; // the tag of the node contains the full path of the ftp directory. FullPath filePath = (FullPath)node.Tag; // calc if the node contains a single, empty node. if ((node.Nodes.Count == 1) && (Stringer.GetFromStringObject(node.Nodes[0].Tag, "") == "empty")) { node.Nodes.Clear(); try { wasCursor = Cursor.Current; Cursor.Current = Cursors.WaitCursor; mFtpDirTree.BeginUpdate(); FtpDirTree_FillDirNode(filePath, node); } finally { mFtpDirTree.EndUpdate(); Cursor.Current = wasCursor; } } }