Hi,

I felt tempted to ask you for code, so if I got this wrong, I think
I'll need it to figure out the problem... but just happens that I have
some fortune-teller skills :P, and I think this is your case:

You start a thread... in that thread you create a form, then the
thread ends... and the form is gone. Also notice that the form need a
message loop to work... well that's where the thread is all the time
"waiting"* events. *retrieving them from the thread message queue
actually. You will have to call Application.Run* on the thread to
start the message loop on the other thread and also keep the thread
running until the form is closed by the user or programatically.
*Give a look to what Program.Main does.

I have a feeling of some other dark shadow comming... and has the syn
flag on it. What info do you need to pass from a form to the other?
Decide when something is static or just thread static (static for the
thread), if you are passing info that's not a value type you may need
to use "lock", and if you are sharing static fields then "volatile"
when possible. there are other methods, but in doubt: "lock", if it
hits performance, then you may want to look for something else.

And tell how that goes ^_^

Theraot

On 18 mayo, 07:52, Renato <[email protected]> wrote:
> I tried create each form on a Thread, but the form doesn´t show up when I 
> call t.start()..... any ideas ?
>
> ________________________________
> From: Theraot <[email protected]>
> To: "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web 
> Services,.NET Remoting" <[email protected]>
> Sent: Tue, May 18, 2010 4:12:58 AM
> Subject: [DotNetDevelopment] Re: Form1 blocking florm2 on C#
>
> Hi,
>
> You got a case there...
> Try using 
> this:http://msdn.microsoft.com/en-us/library/system.windows.forms.control....
> and 
> thishttp://msdn.microsoft.com/en-us/library/system.windows.forms.control....
>
> By the way... if this is so critical... why to creating each form on a
> thread? You know only the thread that creates a form or a control can
> modify it, and the you (as most do) create them on the same thread, of
> course they will interfere... but the idea is that GUI operations to
> be as inexpensive as possible.
>
> Theraot.
>
> On 17 mayo, 14:57, Renato <[email protected]> wrote:
>
>
>
> > Hi, I am with a problem in my code.
> > I have two forms, form1 and form2, form 2 has a datagridview that every 13 
> > seconds, it is atualized by sql
> > server information. My class for a search on sql server is executed in a 
> > thread, but even so, when the form2 is updating, the form1 stays
> > blocked and I can´t put some informations on form1 window, someone know 
> > what can I do for the form2 do not interfere on
> > form1 ?
>
> > Thanks,
> > Renato

Reply via email to