O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Use a Callback with an Asynchronous Call

Problem

You want to be notified as soon as an asynchronous call completes, without needing to poll the IAsyncResult object.

Solution

Use a callback, which will be triggered automatically when the call completes.

Discussion

Often, when you start a multithreaded task in an application, you don’t want the additional complexity and overhead of monitoring that task. The solution is to use a callback. With a callback, your code executes a function or subroutine asynchronously and carries on with other work. Your callback procedure is automatically invoked when the asynchronous call is finished.

The callback approach allows you to separate the code that processes asynchronous tasks from the code that performs work on ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required