[Mono-bugs] [Bug 386715] Performance Problem when filling a TreeView

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon May 5 10:58:21 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=386715

User jpobst at novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=386715#c1


Jonathan Pobst <jpobst at novell.com> changed:

           What    |Removed                                         |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                                        |RESOLVED
         Resolution|                                                |INVALID




--- Comment #1 from Jonathan Pobst <jpobst at novell.com>  2008-05-05 08:58:21 MST ---
You need to use BeginUpdate/EndUpdate around your add loop, which will give you
much better performance on both Mono and .Net:

private void FillTree_Click (object sender, EventArgs args)
{
  m_Tree.BeginUpdate ();

  for (int i = 0; i < 2000; i++) {
    TreeNode tn = new TreeNode (i.ToString ());
    tn.Name = i.ToString ();
    m_Tree.Nodes.Add (tn);

    for (int j = 0; j < 5; j++) {
      TreeNode subtn = new TreeNode (j.ToString ());
      subtn.Name = j.ToString ();
      tn.Nodes.Add (subtn);
    }
  }

  m_Tree.EndUpdate ();
}


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list