473,804 Members | 3,021 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(C opyCompletion);
DoCopy.BeginInv oke(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 5368
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***@discussi ons.microsoft.c om> wrote in message
news:41******** *************** ***********@mic rosoft.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(C opyCompletion);
DoCopy.BeginInv oke(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 contradistincti on 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(ob ject 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(R eportCopyComple tion);
CopyEvent.Begin Invoke(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***@discussi ons.microsoft.c om> wrote in message
news:41******** *************** ***********@mic rosoft.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(C opyCompletion);
DoCopy.BeginInv oke(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
293
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. Does anyone know the way to cancel the use of a callback routine? John
4
1568
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 MethodInvoker instead as in following example :
4
2236
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 AsyncDelegate (string server); private void GetServerInfo (string server) { AsyncDelegate ad = new AsyncDelegate(GetServerArray);
1
2843
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 remote server and display this info on the UI. From doing some research, I know that the way my implementation works today is not thread-safe, because essentially my worker thread updates the UI, which is BAD. So, here I am trying to figure out how...
1
1795
by: MSDN | last post by:
Does anyone know how to do this with a readline statement or equivalent method? Thanks in advance. Chris
0
1626
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 using asynchronous webservices calls. The number of webservices called concurrent is between 1 and 18. The webservice calls are made using SSL with a X509 clientcertificate. The application is underhigh load
7
9719
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 for this being to stop the user thinking the application has frozen when in fact it is just waiting for a long SP to complete. Another reason for doing it like this is that I also have had a problem in the past where the SP takes longer than the...
2
4115
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 asynchronous web request complete. My doubt is if timeout error occured while processing asynchronous webrquest, will call back i set on beginwebreqest gets executed or not.
3
2099
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 different stages of execution. However I was wondering if there was any information available regarding the limitations of the asynchronous model, in particular maximum numbers of asynchronous elements, and limitations of multiple requests potentially...
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10583
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10337
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10323
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9160
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7622
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6854
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3822
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.