-
Expert Member
Treeview Control
In the load event of the form, you write code to populate the treeview control namedtvemployees. You declare string variables strdept, stremployee, and strkey for the department,employee, and key values needed. You declare node variable nodnew to add nodes to the treeviewcontrol. Which code fragment will populate the treeview control?
(A) set nodnew=tvemployees.nodes.add(key:="root", text: =strdept) setnodnew=tvemployees.nodes.add (relative: ="root", _relationship:=tvwchild, key:=strkey, text:=strempfoyee)
(B) set nodnew=tvemployees.nodes(key:="root", text: =strdept) setnodnew=tvemployees.nodes (relative: ="root", _ relationship:=tvwchild, key:=strkey, text:=strempfoyee)
(C) set nodnew=tvemployees.nodes.add(key:="root") set nodnew=tvemployees.nodes.add(relative: ="root", _ relationship:=tvwchild, key:=strkey, text:=strempfoyee)
(D) set nodnew=tvemployees.nodes(key:="root", text: =strdept) setnodnew=tvemployees.nodes ( relationship:=tvwchild, text:=strempfoyee)
-
Junior Member
Re: Treeview Control - Ex
// First it is a good practice that you clear what ever nodes there in the tree
// view control. You should do that first:
if (m_oTreeView.Nodes.Count > 0)
{
m_oTreeView.Nodes.Clear();
}
// second: Suppress repainting the TreeView until all the objects have
// been created
m_oTreeView.BeginUpdate();
// then you fill the tree as being expalined in the previous postings
//last Begin repainting the TreeView.
m_oTreeView.EndUpdate();
// then it is an optional that you expand all the tree or not
m_oTreeView.ExpandAll();
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules