Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

.NET Forum


You are currently viewing our .NET Forum as a guest. Please register to participate.
Login



Closed Thread
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: 100
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,
__________________

Please login or register to view this content. Registration is FREE

ASP.NET 3.5 | SQL 2005 Database | US Based Hosting Company | 24 X 7 Support | Daily Backups | Uptime Guarantee | Affiliates - $50 Per Sale
|
Please login or register to view this content. Registration is FREE
twhdir is offline
View Public Profile
 
 
Register now for full access!
Old 08-27-2009, 04:26 PM Re: How to open a new form on its own thread
Experienced Talker

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

Posts: 100
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.
__________________

Please login or register to view this content. Registration is FREE

ASP.NET 3.5 | SQL 2005 Database | US Based Hosting Company | 24 X 7 Support | Daily Backups | Uptime Guarantee | Affiliates - $50 Per Sale
|
Please login or register to view this content. Registration is FREE
twhdir is offline
View Public Profile
 
Old 09-08-2009, 06:37 AM Re: How to open a new form on its own thread
skywind's Avatar
Skilled Talker

Posts: 74
Trades: 0
use response.redirect
__________________

Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
skywind is offline
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: 100
Trades: 0
How come we can use Response.Redirect on WINDOWS FORMs? That function is even not valid there.
__________________

Please login or register to view this content. Registration is FREE

ASP.NET 3.5 | SQL 2005 Database | US Based Hosting Company | 24 X 7 Support | Daily Backups | Uptime Guarantee | Affiliates - $50 Per Sale
|
Please login or register to view this content. Registration is FREE
twhdir is offline
View Public Profile
 
Old 01-04-2010, 04:22 PM Re: How to open a new form on its own thread
Novice Talker

Posts: 10
Name: Dean
Trades: 0
you need to invoke the method.

public void CheckWindow()
{
Invoke(new MethodInvoker(new Form1().Show));
}
wren is offline
View Public Profile
 
Closed Thread     « 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.17771 seconds with 12 queries