Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / December 2004

Tip: Looking for answers? Try searching our database.

c# slow treeview

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
orenwantsyou@walla.com - 19 Dec 2004 09:04 GMT
hi all,
i have a c# winform application and a web appliaction.
in the winform app. i use a treeview control, and in the web app. i use
an htc control.
the problem is that the winform application is loading very slow(the
tree), whereas the web application's tree is loading quicker.
both applications usews the same functions when it creates the tree,
anyone knows why????
GreggTB - 19 Dec 2004 17:59 GMT
If you can post the code you're using to populate the treeview, that
might help in identifying any problems!

Thanks!

> hi all,
> i have a c# winform application and a web appliaction.
[quoted text clipped - 4 lines]
> both applications usews the same functions when it creates the tree,
> anyone knows why????
orenwantsyou@walla.com - 20 Dec 2004 08:02 GMT
it's a bit of a problem, since that there many functions that are being
called in the way.
i digged the code, and i think that it's not the treeview fault, but
i'm not sure.
i removed the part when the treevies/htc is rendered , and the problem
still occured.
GreggTB - 20 Dec 2004 21:43 GMT
Okay...one thing you want to keep in mind is that you should call the
treeview's BeginUpdate and EndUpdate methods at the point(s) where you
load the data into the treeview. This isn't such a big deal (I don't
think) when you're using the AddRange() method but if you're adding the
tree's items individually, then you'll definitely want to use these
methods to disable repainting of the treeview prior to the update and
then re-enable painting of the treeview after the update.

So you'll have something like...

/******************************************/
myTreeView.BeginUpdate();
// create and populate the tree view based on individual
//    items in a collection...
foreach(BeerCan obj in Fridge)
{
myTreeView.Nodes.Add(new TreeNode("Beer Name: " + obj.Name));
}
myTreeView.EndUpdate();
/******************************************/

Other than that, you may just want to make sure that your other code is
optimized (which you already said you want to check on).
Good luck!
orenwantsyou@walla.com - 20 Dec 2004 08:02 GMT
it's a bit of a problem, since that there many functions that are being
called in the way.
i digged the code, and i think that it's not the treeview fault, but
i'm not sure.
i removed the part when the treevies/htc is rendered , and the problem
still occured.
i

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.