469,290 Members | 1,930 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,290 developers. It's quick & easy.

How to show a form in new thread ?

How to show a form in new thread ?
My form will be shown when main form doing a large process.

Could you tell me how to create and control this new form?

Thanks

Charles Shao :-)
Nov 17 '05 #1
4 52186
The this.mymethod is the method that will launch your new form. The form is
launched in a separeate thread.

System.Threading.Thread t = new System.Threading.Thread(new
System.Threading.ThreadStart(this.mymethod));
t.Start();

"cyshao" <ad****@263.net> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
How to show a form in new thread ?
My form will be shown when main form doing a large process.

Could you tell me how to create and control this new form?

Thanks

Charles Shao :-)

Nov 17 '05 #2
All gui should be done by the main thread (i.e the thread that start
your application) to access any gui from another thread you have to
use one of the invoke methods.

On Tue, 29 Mar 2005 10:54:22 +0200, "Ole Hanson" <no@spam.com> wrote:
The this.mymethod is the method that will launch your new form. The form is
launched in a separeate thread.

System.Threading.Thread t = new System.Threading.Thread(new
System.Threading.ThreadStart(this.mymethod));
t.Start();

"cyshao" <ad****@263.net> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
How to show a form in new thread ?
My form will be shown when main form doing a large process.

Could you tell me how to create and control this new form?

Thanks

Charles Shao :-)


Nov 17 '05 #3

"QWERTY" <no@email.com> wrote in message
news:8i********************************@4ax.com...
All gui should be done by the main thread (i.e the thread that start
your application) to access any gui from another thread you have to
use one of the invoke methods.


This is a serious misconseption, you can have as much GUI threads as you
like, as long as you respect the GUI threading rules imposed by Windows,
that is you need to pump messages and you shouldn't touch the windows
elements directly from other threads. When drag and drop support is needed
or when you host ActiveX controls on the forms, make sure your thread runs
in a STA.

Willy.

Nov 17 '05 #4
emr
private void showForm() {
Form form1= new Form();
form1.show();
}
Thread sf= new Thread(new ThreadStart(showForm);
sf.Start();
Nov 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Zzzbla | last post: by
4 posts views Thread by Altramagnus | last post: by
8 posts views Thread by MV | last post: by
4 posts views Thread by DBC User | last post: by
3 posts views Thread by Robert Dufour | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.