Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / August 2005

Tip: Looking for answers? Try searching our database.

user interface feedback

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bassam - 20 Aug 2005 13:16 GMT
Hello

does anyone know the method of refreshing the user interface while a windows
form is handling deep calculations , i want to reflect some data on some
labels and text boxes but the from is freeze till calculation is finished ,
i know i can use another thread but i remember there was a very simple
method to do the events of the form and show the results immediately,
something like .DoEvents

any help appreciated

Regards
Bassam
Oliver Sturm - 20 Aug 2005 13:32 GMT
> does anyone know the method of refreshing the user interface while a windows
> form is handling deep calculations , i want to reflect some data on some
> labels and text boxes but the from is freeze till calculation is finished ,
> i know i can use another thread but i remember there was a very simple
> method to do the events of the form and show the results immediately,
> something like .DoEvents

What you mean is probably Application.DoEvents(). But I seriously advise
you to do this stuff in another thread - it's the much cleaner and more
flexible way, and it will leave your UI a lot more responsive than any
approach using DoEvents().

               Oliver Sturm
Signature

omnibus ex nihilo ducendis sufficit unum
Spaces inserted to prevent google email destruction:
MSN oliver @ sturmnet.org Jabber sturm @ amessage.de
ICQ 27142619 http://www.sturmnet.org/blog

Metallikanz! - 20 Aug 2005 18:16 GMT
If you do not want to directly manipulate threads to get your work done, wrap the long running method with a delegate and do an asynchronous invocation, the FW will take care of queuing and executing it on the thread pool thread.

HTH, Metallikanz!

> Hello
>
[quoted text clipped - 9 lines]
> Regards
> Bassam
Mark R. Dawson - 21 Aug 2005 04:27 GMT
You can use the threadPool in this case because it does not look like you are
using many threads, but in general long running tasks should not be run using
threads from the threadpool.  Threadpool threads are a shared resource, 25
threads per thread per processor,  so tying up these threads can lead to
actions being delayed if there are not threads currently available in the
pool.  For any long running task it is recommended that you create your own
thread to handle the task.

Also when running actions from a threadpool thread any exception that
happens in your code will be supressed by the CLR if you do not handle it
correctly, so you need to take special care in your exception handling :-)

> If you do not want to directly manipulate threads to get your work done, wrap the long running method with a delegate and do an asynchronous invocation, the FW will take care of queuing and executing it on the thread pool thread.
>
[quoted text clipped - 13 lines]
> > Regards
> > Bassam
alantolan@users.com - 22 Aug 2005 20:19 GMT
Also, if you are going to be using a separate thread (either explicitly
creating one or invoking a delegate) you should not use that thread to
update the UI. Only the UI thread should do this.

Check out Ted Pattison's articles on MSDN Magazine for some nice intro
articles on threading and updating the UI.

hth,
Alan.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.