|
-
Mar 9th, 2012, 12:26 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Multi-threading Difficulties
Okay, so here is the difficulty. I have a main form on which there are controls I need to manipulate. This manipulation is quite resource intensive for a few seconds as it makes call to API's of other running MS Office software products.
I also have a loading form on which there is an animated loading gif picture. In order to ensure that the animated gif runs, I have had to fire the control manipulation onto a new thread but this is causing difficulties. I'll explain further:
- I have Form A on which there is a datagrid
- I have Form B on which there is a loading style animated gif
- I create a new background worker thread on Form A which should make the API calls and populate the datagrid.
- Thread 2 (the worker thread) doesn't like this because it isn't thread safe. So instead, I have had to use the Invoke method to access Thread 1 again to manipulate the controls; making the entire process pointless.
- Because Thread 1 is having to work again, the loading form freezes.
In short, what should I do? I have considered creating yet another thread, but i'm not sure whether or not this would help. In short, how can I keep Thread 1 smooth when another Thread has to access it using the Invoke method because otherwise it isn't thread-safe. :/
Argh!
Last edited by intraman; Mar 9th, 2012 at 12:54 PM.
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
|
Click Here to Expand Forum to Full Width
|