|
-
Aug 28th, 2006, 02:00 PM
#1
Thread Starter
Member
[RESOLVED] Referencing a Form on a Seperate Thread...?
I converted my code from VS2003 to VS2005 and came across a threading issue. In 2003, it worked without a problem, but now 2005 complains about Cross-Threading.
I created a "Progress Bar Form" which when displayed, runs the ShowDialog() method on a seperate thread in order to allow the calling thread to continue processing, yet maintain the ShowDialog() features. Problem is that calling ShowDialog() without a parent form parameter can cause the form to display in strange location on your screen. So I added the option to define the parent form to which the "Progress Form" would center against. Problem is, that when the "Progress Form" is displayed on a secondary thread, it is passed a reference to the parent for it to center on, which is now on a different thread (the main thread), and VS2005 crashes complaining about Cross-Threading.
Now, I am relatively new to Multi-Threading, and I have gotten some migrains debugging Threading problems before . I was hoping that someone here would be able to give me some idea's or pointers on how I can fix this particular Cross-Threading issue...?
Last edited by BSantiag; Aug 28th, 2006 at 02:04 PM.
Ben Santiago, MCP & A+
Programmer Analyst(SQL, FoxPro, VB, VB.Net, Java, HTML, ASP, JSP, VBS)
Eastern Suffolk BOCES - Student Data Services
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
-Rich Cook
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
|