Multithreading in Visual Basic.NET: Demo

Category:
C#, VB.NET, ASP.NET
Type:
Applications
Difficulty:
Advanced
Author:
Pramod Kumar Singh

Version Compatibility: Visual Basic.NET

More information:
The sample code demonstrates multithreading in VB.NET. The application creates two threads that are accesing the same account amount.This reqires synchronization of threads, which is accomplished in VB.NET through use of the Monitor object of the the Thread class.

To run this code, create a new Console application in Visual Basic.NET, paste the code into the code window, right click the project name and select project properties, and change the startup object to Thread Sample.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: