VB.NET Faces Off Against Classic VB : Page 11

VB.NET, the .NET Framework, and Visual Studio.NET together form a potent combination that can simplify your code and reduce errors; however, to truly supplant existing versions of VB as a RAD tool, Visual Studio needs Break-Edit-Continue.

by A. Russell Jones

Jul 8, 2001

Page 11 of 11

WEBINAR:

On-Demand

Full Text Search: The Key to Better Natural Language Queries for NoSQL in Node.js

Read the contents of a text fileFile IO has changed considerably in .NET. If you have been using the FileSystemObject to read and write text files, you'll feel comfortable quickly. If you've been using the intrinsic VB commands, such as Open, Get, and Put, file IO may seem strange at first. The example uses the intrinsic VB commands.

Both the VB and VB.NET versions perform the same tasks: retrieve the Windows folder path from the SystemRoot environment variable, ensure that the Win.ini file exists in the Windows folder, then open and read the contents of the file, and assign the resulting string to a multiline TextBox control. You can read the file with a single command in both versions, but the VB.NET version is much more intuitive. For example, it's obvious what the "File.Exists" does, but not nearly as obvious what the Dir$ command does.

You can't point to just one or two things that make VB.NET easier to work withit's the little things that make VB.NET and Visual Studio easier than previous versions. Sometimes, VS.NET requires less code; sometimes the long object names and numerous objects create more code. But after you learn a little about the framework, it almost always creates code that's easier to understand and maintain.