Advanced VB.NET Programming – Threads, Events and Delegates (Part 2)



Advanced VB.NET Programming – Threads, Events and Delegates (Part 2)

Advanced VB.NET Programming – Threads, Events and Delegates (Part 2)

This is the second of two computer science lessons about threads, events and delegates. In these two lessons, you will learn how to create a multi-threaded racing game in Visual Basic.NET. The application makes use of the .NET Thread class, which allows you to build responsive applications that can run multiple sub programs at the same time. The game employs custom events to signal changes while the application is running, and delegates, otherwise known as type safe method pointers, to safely marshal method calls between threads. By following along and building this application yourself, you’ll come to see that threads, events and delegates are closely related. To get the most out of this video, you should already be familiar with the basics of high level programming. It would also be advantageous to have some familiarity with object oriented programming. You can find the essentials of object oriented programming with VB.NET in a separate series of computer science lessons. If you’re a C# programmer you still find these videos useful because, although there are some differences in language syntax, the fundamental concepts are the same.

Chapters:
00:00 Introduction
01:10 Write a custom event and an event handler
02:56 Raise an event
05:00 Race condition
07:24 SyncLock
08:30 Dynamic event handler assignment with AddHandler
09:45 Abort a thread
12:29 ThreadAbortException
14:54 The benefits of events?
17:17 Run an event handler on a separate thread
18:45 Cross thread operations

Comments are closed.