473,406 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

treeview and multithreading

I have an app that populates a treeview from a DB. I would like the UI to
repaint during this potentially long operation, so I want to spawn a new
thread to populate the list. The problem is how to update the treeview from
the worker thread without violating the prime directive of Windows
programming-Though shalt not operate on a window from other than its
creating thread.

Can someone point me to a simple implementation of this? Thanks!
Nov 16 '05 #1
1 2350
You have several options. First, you can pre-create all of your nodes. Then
add them
later. If you have thousands of nodes, and you really need to insert them over
time, then
you just need to BeginInvoke or Invoke your insertion delegate. I have a sample
showing
async operations over a ListBox that might help, though I don't have one
available for the
TreeView.

What does it take to make an Asynchronously drawn ListBox in Windows Forms?
http://weblogs.asp.net/justin_rogers.../01/65805.aspx

--
Justin Rogers
DigiTec Web Consultants, LLC.
Blog: http://weblogs.asp.net/justin_rogers
"Mitch A" <no*@none.com> wrote in message news:40**********@newspeer2.tds.net...
I have an app that populates a treeview from a DB. I would like the UI to
repaint during this potentially long operation, so I want to spawn a new
thread to populate the list. The problem is how to update the treeview from
the worker thread without violating the prime directive of Windows
programming-Though shalt not operate on a window from other than its
creating thread.

Can someone point me to a simple implementation of this? Thanks!

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

47
by: mihai | last post by:
What does the standard say about those two? Is any assurance that the use of STL is thread safe? Have a nice day, Mihai.
0
by: Helge Lenuweit | last post by:
Hello, I have an application that uses TreeView and ListView just like Windows Explorer or Outlook. You click on a tree node and the list is filled up with corresponding elements. My list...
16
by: Robert Zurer | last post by:
Can anyone suggest the best book or part of a book on this subject. I'm looking for an in-depth treatment with examples in C# TIA Robert Zurer robert@zurer.com
5
by: sarge | last post by:
I would like to know how to perform simple multithreading. I had created a simple form to test out if I was multithreading properly, but got buggy results. Sometime the whole thig would lock up...
2
by: Rich | last post by:
Hello, I have set up a multithreading routine in a Test VB.net proj, and it appears to be working OK in debug mode and I am not using synchronization. Multithreading is a new thing for me, and...
6
by: Jarod_24 | last post by:
This is the exception i'm getting: System.InvalidOperationException: The action being performed on this control is being called from the wrong thread. You must marshal to the correct thread using...
5
by: sandy82 | last post by:
Whats actuallly multithreading is ... and how threading and multithreading differ . Can any1 guide how multithreading is used on the Web .. i mean a practical scenario in which u use...
7
by: Ray | last post by:
Hello, Greetings! I'm looking for a solid C++ multithreading book. Can you recommend one? I don't think I've seen a multithreading C++ book that everybody thinks is good (like Effective C++ or...
1
AMaxin
by: AMaxin | last post by:
Hi I have a custom control with a treeview which queries a web service for its contents. I would like to have the nodes populateon a separate thread (for obvious reasons) . So, in my travels, I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.