Re: Putting a Form on a new thread



The problem is that after StartForm finishes executing, the thread
dies. Any thread will die after it runs out of code to execute.

The real question here is, why are you trying to have a seperate thread
own the Form? UI resources are really meant to be owned by the main
thread. It really makes more sense to have a seperate thread do
something with or to the Form.


Brandon Owensby wrote:
> I will not do the actuall code but a small representation
>
> I know this may look slightly weird but yes I have to have the 2nd
class and
> yes the second class will fire its code from the constructor. All I
need is
> some guidence as to how its suppose to be done even if it doesn't fit
this
> mode and I will make it fit my mode somehow.
>
> Thanks,
> Brandon
>
>
>
> public class Form
> {
> public Form()
> {
> --code to setup window
> this.Show()
> --more code to setup window
> }
> }
>
> public class FormStarter
> {
> FormStarter()
> {
> new System.Threading.Thread(new
> System.Threading.ThreadStart(this.StartForm)).Start();
> }
>
> public void StartForm()
> {
> new Form();
> }
> }

.