Home > Articles > Programming > Windows Programming

A First Look at VB 7.0 and the .NET Framework

📄 Contents

  1. A First Look at VB 7.0 and the .NET Framework
  2. A New Ballgame
  3. Summary
Dan Fox takes a look at what is on the horizon for the next version of Visual Basic, and how it relates to Microsoft's new .NET initiative.

Abstract: Dan Fox takes a look at what is on the horizon for the next version of Visual Basic, and how it relates to Microsoft's new .NET initiative.

Regular readers of InformIT have no doubt already noticed the coverage of Microsoft's newest language, C#. As a result, you're aware that C# will debut in the next release of Microsoft Visual Studio, version 7.0, tentatively referred to as Visual Studio .NET. What you may not be aware of is that much of the power and the features found in C# will also make their way into VB 7.0 (or VB .NET, if you prefer). In this article, I'll take you through a few of those features and show you how VB takes advantage of the Microsoft .NET Framework. Before I get started, I should note that the code in this article was built with the PDC Tech Preview version of VS 7.0, the core of which can be downloaded from MSDN at http://msdn.microsoft.com/sdfsfdsdf. As a result, any of the specifics discussed here are liable to change before the product is released.

Sometimes Less Is More

To be sure, the most interesting aspect of VB 7.0 is that it derives its core features from the .NET Framework (formerly known as Next Generation Windows Services or NGWS). Simply put, the .NET Framework provides a set of class libraries and a run-time engine that multiple languages share. From this perspective, you can think of Visual Basic as one of many possible wrappers around the .NET Framework, with very little, other than syntax and program structure, that is VB-specific. However, as you'll see, far from restricting VB, this architecture allows VB to extend itself all the way across the enterprise.

Perhaps the most important feature of the .NET Framework is its class libraries. The class libraries are grouped together in namespaces and are supplied to allow consistent access to system services. The class libraries encapsulate and abstract everything from the low-level operating system services such as IO to high-level services such as messaging using MSMQ. This architecture should make life easier by providing a well-debugged and reusable set of classes. This feature alone should be a boon to VB developers who frequently amass their own code libraries to deal with thorny Win32 issues or services such as string manipulation, sorting and searching, and hashing.

Using a class library also affords simplicity since a developer needn't use a combination of Win32 API calls and COM objects, each with their own sets of rules. A particularly good example of classes that provide these benefits are found in the System.Net namespace. This namespace includes classes that provide services to allow applications to communicate over the Internet using HTTP and FTP. An additional benefit that should be apparent is that by releasing new classes, VB developers can easily take advantage of new system services. For example, the incorporation of the ASP+ technologies into class libraries allows VB to easily create web applications without reliance on propriety schemes such as the Web classes and Dynamic HTML projects introduced in VB 6.0. The classes within the libraries are also object oriented and, as a result, can be extended by a developer through inheritance when implementing specific features. The PDC version of the .NET Framework ships with references to 87 different namespaces that comprise hundreds of classes. A small sampling of these namespaces (adapted from Jeffery Richter's article on MSDN at http://msdn.microsoft.com/msdnmag/issues/0900/framework/framework.asp) can be seen in the following table.

Purpose

Namespace

Example Classes

Provides basic types, top-level namespace

System

Object, Buffer, Byte, Char, Array, Int32, Exception, String

Managing collections of types

System.Collections

ArrayList, BitArray, Dictionary, Hashtable, Queue, SortedList, Stack

Accessing data through ADO+

System.Data

DataBinding, DataRelation, DataRow, DataSet, DataTable, DataSource

Resource for internationalization

System.Globalization

Calendar, CultureInfo, JulianCalendar, NumberFormatInfo, NumberStyles, RegionInfo

Reading and writing data through streams

System.IO

ByteStream, File, FileStream, MemoryStream, Path, StreamReader, StreamWriter

Accessing resources over the network

System.Net

WebRequest, WebResponse, TcpClient, TcpListener, UdpClient, Sockets

Implementing security using authentication and encryption

System.Security

Permissions, Policy, Principal, Util, Cryptography

Implementing UI controls for web-based applications

System.Web.UI.WebControls

AdRotator, BorderStyle, DataGrid, HyperLink, ListBox, Panel, RadioButton, Table

Providing a shared forms package for desktop applications

System.WinForms

Button, CheckBox, DataGrid, FileDialog, Form, ListBox, MainMenu, MonthCalendar, NewFontDialog, RichEdit, ToolBarTreeView

Using timers and scheduling

System.Timers

Timer, Schedule, DailyPattern, MonthlyPattern, RecurrencePattern

Creating multithreaded applications

System.Threading

Monitor, Mutex, Thread, ThreadPool, Timer

The second core feature of the .NET Framework is the use of a common run-time engine. All applications compiled to use the run-time produce "managed code", as opposed to "unmanaged code" produced by the current generation of the development tools. VB 7.0 will only produce code that uses the run-time and hence only managed applications. In other words, instead of VB apps calling into the infamous VB runtime (msvbvm60.dll for example), they will instead call into a run-time engine shared by VC++, C#, JScript, and Visual FoxPro for starters, although among these, VC++ will also be able to produce unmanaged executables. Microsoft will also release a standard dubbed the Common Language Specification (CLS) that will allow other vendors to produce compilers that work with the .NET run-time.

The architecture of the .NET run-time (found in MSCorEE.dll) is significantly different from what VB developers are used to. For example, rather than produce a native executable, VB 7.0 will produce a Portable Executable (PE) file that contains a CPU-independent machine language called MSIL. Although I can almost hear the crashing hopes of many seasoned VB developers as they recall the time and sweat that it took for native compilation to finally make it into VB 5.0, rest assured the benefits of an intermediate language executable are significant. For starters, as expected MSIL provides the benefits of hardware abstraction and security that developers can take advantage of if the .NET run-time is ported to other platforms and new versions of Windows (64 bit). However, the .NET run-time also uses Just-In-Time (JIT) compilation to offset the performance penalty normally invoked when compiling an application as it is loaded. To further increase performance, the JIT compiler can also take advantage of particularities in the machine state (such as CPU type) or patterns in program data when the application runs to increase performance at run-time. Expect improvements such as these to be made incrementally as Microsoft refines the run-time engine.

Aside from performance, the run-time also provides several other features. For example, since the .NET run-time is shared by multiple languages, it also provides the ability for those languages to reuse code from one another. For example, a class created in C# can be extended through inheritance in VB to provide additional functionality. This integration also makes it possible to do cross-language debugging more easily through a common debugger. The run-time is also object oriented and provides object creation and management facilities (referred to as the Virtual Object System or VOS) exposed through the System.Object class. The VOS is in many ways analogous to the COM system libraries that are currently a part of Windows, although VOS's inclusion in the run-time makes them more portable and self-contained. Other general benefits of the run-time include features that VB developers are familiar with such as type safety and garbage collection.

While the run-time provides the underlying architecture, the .NET Framework also changes the way you'll view applications. In an effort to eliminate the most persistent support headaches, the scheme for packaging and deploying applications has altogether changed. An application is now deployed as a collection of files referred to as an "assembly" that includes its own self-referencing "manifest", which contains references to all the resources, down to the particular version, that the application needs. This scheme allows the run-time to load the appropriately versioned classes for the application. As a result, all applications built in VB 7.0 will have everything they need to run correctly when deployed to a different machine. Although there are subtle variations, by and large applications can be deployed simply by copying a directory structure to a new machine. This scheme also alleviates the "DLL Hell" problem that occurs when an application overwrites a DLL upon which another application is dependent. In addition, the inclusion of the VOS means that applications no longer need to rely on the registry for COM component creation, a continual source of confusion for developers and users. While some hail this as the "death of COM", it is still possible to call unmanaged COM components from VB 7.0.

As mentioned above, VB can be thought of merely as packaging over the .NET Framework. In the remainder of this article, we'll explore the packaging to see how VB exposes the features of the .NET Framework.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020