.Net (or VB7.0) is not an upgrade to VB 6.0; it is a completely new language written
from the ground up to be compatible with Microsofts "dotnet" Common Language
Runtime. The legacy VB language was used as a general guide for syntax but backwards
compatibility was sacrificed at so many points that there is little code that can be directly
ported. If you are looking at VB.Net as a potential upgrade path for current applications
or as a tool for current developers to move into and then learn new features you are
probably going to have significant problems. The Visual Basic 6.0 runtime is great at
simplifying many of the common programming tasks. But having this simplifying layer
has meant that you cant use a new operating system feature, such as DirectX, until there
is a Visual Basic-accessible wrapper around it. As a Visual Basic developer, the most
important benefit you get from the .NET Framework is direct and easy access to the
underlying .NET platform using a consistent programming model. This means you can
build applications with Visual Basic.NET that were not easy or not possible to build with
Visual Basic 6.0. As a Visual Basic 6.0 developer, you will appreciate now having access
to the same features and capabilities as other platform languages. For example, to create a
Windows Service, you no longer have to write it in Visual C++, nor will you have to
resort to hacks or kludges. You can do it all elegantly, cleanly, and easily using Visual
Basic.NET. To give you some examples of what you can do with the .NET Framework,
lets discuss four common tasks that you might need to perform in your applications:
tracing and event logging, multithreading, file system monitoring, and creating Windows
Services. Tracing and Event Logging When building a robust application, you must pay
careful attention to diagnostics and troubleshooting mechanisms. Typically, this involves
writing a tracing component, which handles opening the output destination (event log or
file), writing the trace message, and closing the output destination. You then call methods
on this component throughout your code, passing it the text to log. You invest all this
time and effort to build a tracing and logging subsystem, which ultimately does not
contribute to solving the business problem but is required to build the application. The
.NET Framework includes classes and other data types that make it easy to log trace
messages by providing the logging infrastructure for you. Multithreaded Applications
One of the great features of the .NET Framework is the ability to create multithreaded
applications in Visual Basic without having to use third-party tools or unsupported Visual
Basic tricks. The .NET Frameworks multithreading support is provided by classes and
interfaces in the System.Threading namespace, so all .NET languages can create and
manipulate threads in the same way. System.Threading.Thread is the core class and
provides support for creating and controlling threads. To create a thread, you create a new
System.Threading.Thread object that passes the constructor a ThreadStart delegate. This
delegate represents the method where the thread will begin its execution. When youre
ready to start the new thread, you call Thread.Start() (see Listing 1). As you start to build
multithreaded applications, youll quickly realize the need to control access to shared
resources, such as shared class variables. The .NET Framework also includes several
classes and data types that you can use to synchronize actions performed by two threads.
File System Monitoring Ive come across a few applications that are required to wait and
process files that show up in a particular directory—for example, an application that
imports data from a file into a database. Data files may be downloaded from a mainframe
or otherwise transferred into an input directory, from which the application imports them
into a database. Instead of constantly polling the directory for new files, you can wait for