I am trying to build a tree like the following
Root
|--- Current
|-------- Date1
|-------- Date2
etc.,
First I create the root, then make the root as the selected node and
create Current and add it to the selected node. That is fine. Now I
make the Current as selected node, but, it comes back null. I am using
the following code, does anyone know why would the selected node
comeback null??
Thanks.
treeView3.Nodes .Clear();
treeView3.Nodes .Add(tRoot, tRoot); //tRoot = 'Root' string
treeView3.Expan dAll();
treeView3.Selec tedNode = treeView3.Nodes[tRoot];
TreeNode cnode = new TreeNode();
cnode.Text = currentRoot; //currentRoor = 'Current' string
cnode.Name = currentRoot;
treeView3.Selec tedNode.Nodes.A dd(cnode);
//get treq, it is a database query to fetch all matching
rows
if (tReq.AnyRowAva ilableAll())
{
tReq.Rewind();
do
{
treeView3.Selec tedNode =
treeView3.Nodes[currentRoot];
if (treeView3.Node s[tReq.AName] == null)
{
TreeNode node = new TreeNode();
node.Text = tReq.AName;
node.Name = tReq.AName;
treeView3.Selec tedNode.Nodes.A dd(node);
node = null;
}
} while (tReq.MoveNext( ));
}
Root
|--- Current
|-------- Date1
|-------- Date2
etc.,
First I create the root, then make the root as the selected node and
create Current and add it to the selected node. That is fine. Now I
make the Current as selected node, but, it comes back null. I am using
the following code, does anyone know why would the selected node
comeback null??
Thanks.
treeView3.Nodes .Clear();
treeView3.Nodes .Add(tRoot, tRoot); //tRoot = 'Root' string
treeView3.Expan dAll();
treeView3.Selec tedNode = treeView3.Nodes[tRoot];
TreeNode cnode = new TreeNode();
cnode.Text = currentRoot; //currentRoor = 'Current' string
cnode.Name = currentRoot;
treeView3.Selec tedNode.Nodes.A dd(cnode);
//get treq, it is a database query to fetch all matching
rows
if (tReq.AnyRowAva ilableAll())
{
tReq.Rewind();
do
{
treeView3.Selec tedNode =
treeView3.Nodes[currentRoot];
if (treeView3.Node s[tReq.AName] == null)
{
TreeNode node = new TreeNode();
node.Text = tReq.AName;
node.Name = tReq.AName;
treeView3.Selec tedNode.Nodes.A dd(node);
node = null;
}
} while (tReq.MoveNext( ));
}
Comment