Reply
How to open a new form on its own thread
Old 07-06-2009, 11:15 PM How to open a new form on its own thread
Super Talker

Posts: 101
Trades: 0
I am developing one multithreaded application. I am successfully running my functions on their own thread(created 24 threads already). I am attempting to give its own thread to one function that is rendering a new window in it. I am receiving an error here, due to the single thread architecture.

Is there any way for a form to be had its own thread? Thanks,
__________________
AccuWebHosting.Com - Windows Hosting Expert
ASP.NET 3.5 | SQL 2005 Database | US Based Hosting Company | 24 X 7 Support | Daily Backups | Uptime Guarantee | Affiliates - $50 Per Sale
| Website Hosting
twhdir is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 08-27-2009, 04:26 PM Re: How to open a new form on its own thread
Experienced Talker

Posts: 37
Name: Derek
Location: Virginia Beach
Trades: 0
Can you please post the code you are using?
Derek227 is offline
Reply With Quote
View Public Profile
 
Old 08-31-2009, 04:11 AM Re: How to open a new form on its own thread
Super Talker

Posts: 101
Trades: 0
This is very simple. This is not the actual code, I have converted it to basic statements for the ease of understanding and time saving.

public void Start()
{
Thread t = new Thread(new ThreadStart(this.CheckWindow));
t.Start();
}

public void CheckWindow()
{
Form1 f = new Form1();
f.Show();
}

The new thread t would start executing the given function CheckWindow(), but will not be able to create the window and will throw the STA error.
__________________
AccuWebHosting.Com - Windows Hosting Expert
ASP.NET 3.5 | SQL 2005 Database | US Based Hosting Company | 24 X 7 Support | Daily Backups | Uptime Guarantee | Affiliates - $50 Per Sale
| Website Hosting
twhdir is offline
Reply With Quote
View Public Profile
 
Old 09-08-2009, 06:37 AM Re: How to open a new form on its own thread
skywind's Avatar
Experienced Talker

Posts: 49
Trades: 0
use response.redirect
skywind is offline
Reply With Quote
View Public Profile Visit skywind's homepage!
 
Old 09-12-2009, 07:51 PM Re: How to open a new form on its own thread
Super Talker

Posts: 101
Trades: 0
How come we can use Response.Redirect on WINDOWS FORMs? That function is even not valid there.
__________________
AccuWebHosting.Com - Windows Hosting Expert
ASP.NET 3.5 | SQL 2005 Database | US Based Hosting Company | 24 X 7 Support | Daily Backups | Uptime Guarantee | Affiliates - $50 Per Sale
| Website Hosting
twhdir is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How to open a new form on its own thread
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.11428 seconds with 13 queries