473,386 Members | 2,129 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,386 software developers and data experts.

about BeginInvoke and EndInvoke

Hi All,
There is a problem about asynchronism process.If I run the method by
BeginInvoke() and how can I know when the method is finish? And maybe I can
say when I can use EndInvoke()?
Nov 16 '05 #1
2 8192
Jet Leung <xi**@163.net> wrote:
There is a problem about asynchronism process.If I run the method by
BeginInvoke() and how can I know when the method is finish?
You can specify a callback delegate which is executed after the method
has finished.
And maybe I can say when I can use EndInvoke()?


You can use EndInvoke at any time, but it will block until the delegate
has finished executing.

See http://www.pobox.com/~skeet/csharp/m...ing.html#async
for more information.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
BeginInvoke executes a delegate asynchronously on the thread that the
control's underlying handle was created on, you can then query the
(IAysncResult) interface returned by the method to see if the asynchronous
call has completed, when the asynchronous operation has completed you then
use EndInvoke to retrieve the result of the asynchronous operation.

Hope this helps

Ollie

"Jet Leung" <xi**@163.net> wrote in message
news:eZ*************@tk2msftngp13.phx.gbl...
Hi All,
There is a problem about asynchronism process.If I run the method by
BeginInvoke() and how can I know when the method is finish? And maybe I can say when I can use EndInvoke()?

Nov 16 '05 #3

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

Similar topics

2
by: Nick | last post by:
Hi all, Are the two snippets below equivelent, since they both only continue once the ShowForm method returns??? 1. delShowForm del = new delShowForm(ShowForm); //show form shows a form...
4
by: Max | last post by:
Hi! In <MPG.1b660df23c2f8b6498af23@msnews.microsoft.com> Jon Skeet said that he _believes_ that for UI calls the WinForms team has _basically_ guaranteed that EndInvoke is not required after...
4
by: Jon | last post by:
Why are out parmeters included in an BeginInvoke? They seem to do nothing? TestProgam: using System; namespace TempConsole { class App { public delegate void MyDelegate( out byte b, out...
7
by: nick_tucker | last post by:
Is The following Code valid it is like a mini thread pool(a friend at work wrote it)? I have cut down the code a bit but kept the essential parts. The main part that I am would like explainedis...
6
by: Valerie Hough | last post by:
I'm not entirely sure what the difference is between these two approaches. In order to avoid reentrant code, I was using Control.BeginInvoke in my UI to cause an asynchronous activity to be done...
2
by: =?Utf-8?B?Q2hhcmxpZQ==?= | last post by:
Hi guys, I'm using delegates to execute a group of methods using the BeginInvoke, that works fine; I'm waiting for the asynch thread to return the response using the EndInvoke, that works fine...
5
by: FP | last post by:
Hi, i'm currently developing a class to communicate with a serial device,using the SerialPort component. Basically,the main application will interact with this class through its method "Call",the...
1
by: Curious | last post by:
I have the following code: if (this.InvokeRequired) { IAsyncResult result = this.BeginInvoke(new EventHandler(this.UpdateButtons), new object { this, EventArgs.Empty }); while...
9
by: Bob Altman | last post by:
I'm trying to call a function on a background thread in a C++/CLI (VS 2005) application compiled with /clr. I store a delegate reference in a module-level gcroot. When I call BeginInvoke on the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.