That's the whole reason for the Invoke() method of a control. It overcomes the problem at the expense of a small performance hit.

-----Original Message-----
From: Mehrdad Senobari [mailto:[EMAIL PROTECTED]
Sent: Monday, October 25, 2004 7:50 AM
To: [EMAIL PROTECTED]
Subject: Re: [C#.NET] Process message queue

There is a problem in multithreading within a window form, let me explain it with an example :

private TextBox txtResult;
...
/// Imagine that this is your second thread entry point
public void SecondThread()
{
������� ...
������� txtResult.Text = "please wait ...";
������� ...
}

In this case you will have the same problem and your window app will hang becuase you used one of UI components in thread code. You can't use your UI elements properties and methods in the SecondThread() method.( becuase your window form use single-threaded apartment model ). For more information check this article :
http://msdn.microsoft.com/library/default.asp?url="">

nico_callewaert wrote:

>
>
> Hi,
>
> I'm reading a huge text file into a dataset.� Is there a way to force
> the operating system to process the message queue from time to time
> during that operation, so the end-user will not have the impresiion
> that windows hangs...
>
> Thanks in advance,
>


����� �����
---------------------------------
Do you Yahoo!?
vote.yahoo.com - Register online to vote today!

[Non-text portions of this message have been removed]



Yahoo! Groups Sponsor
ADVERTISEMENT





Yahoo! Groups Links
* To visit your group on the web, go to:
http://groups.yahoo.com/group/CSharpNET/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


Yahoo! Groups Sponsor
ADVERTISEMENT
click here
Web Bug from http://us.adserver.yahoo.com/l?M=295196.4901138.6071305.3001176/D=groups/S=:HM/A=2128215/rand=586363741


Yahoo! Groups Links

Reply via email to