Results 1 to 2 of 2

Thread: Treeview Control

  1. #1
    Expert Member
    Join Date
    Sep 2005
    Answers
    206

    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)


  2. #2
    Junior Member
    Join Date
    Jan 2008
    Answers
    1

    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
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact