473,325 Members | 2,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Proper Way to Update UI from Asynchronous Delegate

How do I update controls on my UI thread from the Asyncronous Delegate? I
understand it's not safe to just try to update it directly from the
asynchronous thread, but I need to figure out how to update it somehow.
Specifically I need to increment a ProgressBar and update text in a Label.

Thanks,
Michael C.
Nov 16 '05 #1
3 16471
My name is Tyrone Hernandez. I grew up on the streets, so I'm familiar
with this kind of shiznit. I am down with this, and I'm going to keep it
real by top-posting.

In my hood, I have a homie named Shaniqua and some times she calls me on
the phone in an asynchronous fashion. Now I'm hip to her jive, so I don't
wanna just hang up. If I feels like talkin to Shaniqua, I talk to her. If
not, I use my power of "Control" to check "IsInvokeRequired" and if it is, I
call Control.BeginInvoke() to upgrade my progress bar.

Well, I'd be likin' to talk more, but my crack dealer is here so I'm
going to call some of his methods. Peace out!

"Michael C" <mi*******@optonline.net> wrote in message
news:OW******************@news4.srv.hcvlny.cv.net. ..
How do I update controls on my UI thread from the Asyncronous Delegate? I
understand it's not safe to just try to update it directly from the
asynchronous thread, but I need to figure out how to update it somehow.
Specifically I need to increment a ProgressBar and update text in a Label.

Thanks,
Michael C.

Nov 16 '05 #2
Yo yo yo T-Man,

How in the hiznell do I chizzeck da IsInvokeRequired and when do I use
BeginInvoke? Shaniqua used to be hot but now she a hood-rat. I wouldn't
give dat gyrl da time o' day. Tell me like I'm da poh-poh's, da five-oh's
or da metro's! I need a sample to get me hooked like da crack dealers
servin on 47th Ave.

Peace bro,
Michael C.

(To the tune of "I ain't mad at'cha" by Tupac):

"We was once two coders of da same kind/
Quick to hit the semi-colon at da same time/
You was stuck on VB but you still bold/
Bought Dot NET and hit da hood swolled"
"Tyrone Hernandez" <me**********@EvilHood.com> wrote in message
news:OA**************@TK2MSFTNGP10.phx.gbl...
My name is Tyrone Hernandez. I grew up on the streets, so I'm familiar
with this kind of shiznit. I am down with this, and I'm going to keep it
real by top-posting.

In my hood, I have a homie named Shaniqua and some times she calls me on the phone in an asynchronous fashion. Now I'm hip to her jive, so I don't
wanna just hang up. If I feels like talkin to Shaniqua, I talk to her. If
not, I use my power of "Control" to check "IsInvokeRequired" and if it is, I call Control.BeginInvoke() to upgrade my progress bar.

Well, I'd be likin' to talk more, but my crack dealer is here so I'm
going to call some of his methods. Peace out!

"Michael C" <mi*******@optonline.net> wrote in message
news:OW******************@news4.srv.hcvlny.cv.net. ..
How do I update controls on my UI thread from the Asyncronous Delegate? I understand it's not safe to just try to update it directly from the
asynchronous thread, but I need to figure out how to update it somehow.
Specifically I need to increment a ProgressBar and update text in a Label.
Thanks,
Michael C.


Nov 16 '05 #3
Michael C <mi*******@optonline.net> wrote:
How do I update controls on my UI thread from the Asyncronous Delegate? I
understand it's not safe to just try to update it directly from the
asynchronous thread, but I need to figure out how to update it somehow.
Specifically I need to increment a ProgressBar and update text in a Label.


See
http://www.pobox.com/~skeet/csharp/m...#windows.forms

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Undecided | last post by:
I have this routine in the ancestor class: protected ISynchronizeInvoke Target; protected void FireAsync(Delegate dlg, params object pList) { if (dlg != null) { Target.BeginInvoke(dlg,...
2
by: Darryl A. J. Staflund | last post by:
Hi there, Can anyone tell me why invoking a single SQL insert statement (well, rather, a method that performs a SQL insert) using an asynchronous delegate should result in twice the number of...
4
by: Michael C | last post by:
Hi all, Is there an easy way to get the parameters of an asynchronous delegate call from the callback function? Here's an example of what I'm trying to do: private delegate ArrayList...
6
by: Sharon | last post by:
How to catch an asynchronous delegate invocation exception? The code: --------------------------------------- String message = “my message”; foreach( MyDelegate handler in...
1
by: Natalia DeBow | last post by:
Hi, I am working on a Windows-based client-server application. I am involved in the development of the remote client modules. I am using asynchronous delegates to obtain information from...
3
by: Stewart | last post by:
Hey Group, Hoping someone can help me out. I have some code which starts up some asynchronous code using a delegate. The code is below. Basically my main code (not shown) calls...
7
by: Susan | last post by:
In the application I am working on, the user makes a request of information from the database. As there is a great deal of information to go through and possibly return, to speed things up, the...
2
by: Matthias S. | last post by:
Hi there, I'd like to invoke a couple of methods retrieved from multiple, dynamically loaded Assemblies (I have the MethodInfo objects) asynchronously and wait for all methods to finish...
4
by: Olli Virta | last post by:
Hi! I'm having problems with my update below. I know there's a where -clause missing, but I just can't figure out how it should be done properly. I'm stuck with that ORA-01427. Thanks for...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shllpp 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.