473,322 Members | 1,718 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,322 software developers and data experts.

put in a asynchronous call with a callback

Hi!

I've implemented many times an asynchronous call of a method with a call
backfunction successfully.

But to implement this with VB.NET is not so successfully. I can implement
all events ProcessingEvent, CompletedEvent, etc.
It works fine and copies all files in the background ...

Bit to make it perfekt I want to implement a callback function wich will be
used to do the final work, show the finished message and so on.

With C# I can do that with a BeginInvoke() on the event object. Looks like

callback = new AsyncCallback(CopyCompletion);
DoCopy.BeginInvoke(this, args, callback, args);

But it is not possible to use BeginInvoke in that way in C#.

How can I do that?

Thanks for your help

Gerda
Nov 21 '05 #1
2 5340
Hi Gerda,

Fortunately you are mistaken. VB.Net uses the same classes and methods. See
my response to Brad Rogers, dated 13/9/05 (UK date :-) and titled Delegates
Help.

I hope that helps.

Rgds, Phil

"Gerda" <Ge***@discussions.microsoft.com> wrote in message
news:41**********************************@microsof t.com...
Hi!

I've implemented many times an asynchronous call of a method with a call
backfunction successfully.

But to implement this with VB.NET is not so successfully. I can implement
all events ProcessingEvent, CompletedEvent, etc.
It works fine and copies all files in the background ...

Bit to make it perfekt I want to implement a callback function wich will
be
used to do the final work, show the finished message and so on.

With C# I can do that with a BeginInvoke() on the event object. Looks like

callback = new AsyncCallback(CopyCompletion);
DoCopy.BeginInvoke(this, args, callback, args);

But it is not possible to use BeginInvoke in that way in C#.

How can I do that?

Thanks for your help

Gerda

Nov 21 '05 #2
Hi Phil!

Your explanation about the use of delegates ar right!

Maybe my statements were not clear. I want to use the event keyword as
antagonism to the delegate keyword!

Why? I don't want to use delegates because anyone is able to access a public
delegate, can add subscribers to it and can fire the event - as well when
there is no event on the publisher side.
When you use a event only the publisher class can fire the event. Coexistent
anyone can add metods to the delegate list.

That's why I want to use events as reasonable contradistinction to delegates.

But my problem is that it seems to be that you can't use events in VB.NET in
the same way in C#.

When you you use VS.NET and type in C# the '.' behind the event variable you
get with the help of intellisense the whole bunch of methods and properties
you also get with a delegate variable. But when you do that in VB.NET you
receive nothing at all with the help of intellisense. There seems to be no
way to use delegate methods, etc. with events in VB.NET!

I want to implement the BeginInvoke() method to put in an callback methode.
But not on a delegate variable but on a event variable.

How to to that?

here is a little sample code:

public event CopyHandler CopyEvent;

public void RunCopyAsync(object argument)
{
if (DoWork != null) // in VB.NET this is not necessary - it's done
automatically
{
DoCopyEventArgs args = new DoCopyEventArgs(argument);
AsyncCallback callback;
callback = new AsyncCallback(ReportCopyCompletion);
CopyEvent.BeginInvoke(this, args, callback, args);
}
}

"Phil G." wrote:
Hi Gerda,

Fortunately you are mistaken. VB.Net uses the same classes and methods. See
my response to Brad Rogers, dated 13/9/05 (UK date :-) and titled Delegates
Help.

I hope that helps.

Rgds, Phil

"Gerda" <Ge***@discussions.microsoft.com> wrote in message
news:41**********************************@microsof t.com...
Hi!

I've implemented many times an asynchronous call of a method with a call
backfunction successfully.

But to implement this with VB.NET is not so successfully. I can implement
all events ProcessingEvent, CompletedEvent, etc.
It works fine and copies all files in the background ...

Bit to make it perfekt I want to implement a callback function wich will
be
used to do the final work, show the finished message and so on.

With C# I can do that with a BeginInvoke() on the event object. Looks like

callback = new AsyncCallback(CopyCompletion);
DoCopy.BeginInvoke(this, args, callback, args);

But it is not possible to use BeginInvoke in that way in C#.

How can I do that?

Thanks for your help

Gerda


Nov 21 '05 #3

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

Similar topics

1
by: John | last post by:
I will be setting up an asynchronous receive routine for a TCP Socket. If the receive callback method is not called within some time interval, I want to cancel the use of the callback method. ...
4
by: Chris | last post by:
Hello, With asynchronous programming : Why does the callback-function (running in a worker thread) may not update the state of a control on the main-form ? The docs say that you must use a...
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...
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...
1
by: MSDN | last post by:
Does anyone know how to do this with a readline statement or equivalent method? Thanks in advance. Chris
0
by: Raymondr | last post by:
Hi, First a brief description of out application: We have a webapplication which calls a couple of webservices during one request (postback). These calls to the webservices are made concurrent...
7
by: Siv | last post by:
Hi, I have a stored procedure that I want to execute and then wait in a loop showing a timer whilst it completes and then carry on once I get notification that it has completed. The main reason...
2
by: archana | last post by:
Hi all, I am processing asynchronous web request with setting timeout using RegisterWaitForSingleObject. On beginwebrequest i am sending address of one callback which i want to execute when...
3
by: =?Utf-8?B?bWs=?= | last post by:
Hi everyone, I need to refactor some of our processes using the asynchronous programming model. I have defined a couple of arrays of delegates to pipline the asynchronous invocations through...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.