What is .NET Framework and the Common Language Runtime?
By: Steven Holzner in VB.net Tutorials on 2008-11-25
VB .NET is only one component of a revolution in Windows-the .NET framework. This framework provides the new support for software development and operating system support in Windows, and it's more extensive than anything we've seen in Windows before. The .NET framework wraps the operating system with its own code, and your VB .NET programs actually deal with .NET code instead of dealing with the operating system itself. And it is specially designed to make working with the Internet easy.
At the base of the .NET framework is the Common Language Runtime (CLR). The CLR is the module that actually runs your VB .NET applications. When you create a VB .NET application, what really happens is that your code is compiled into the CLR's Intermediate Language (named MSIL, or IL for short), much like bytecodes in Java. When you run the application, that IL code is translated into the binary code your computer can understand by some special compilers built into the CLR. Compilers translate your code into something that your machine's hardware, or other software, can deal with directly. In this way, Microsoft can one day create a CLR for operating systems other than Windows, and your VB .NET applications, compiled into IL, will run on them.
The .NET Framework class library is the second major part of the .NET framework. The class library holds an immense amount of prewritten code that all the applications you create with Visual Basic, Visual C++, C#, and other Visual Studio languages build on. The class library gives your program the support it needs-for example, your program may create several forms, and as there is a class for forms in the class library, your program doesn't have to perform all the details of creating those forms from scratch. All your code has to do is declare a new form, and the CLR compilers can get the actual code that supports forms from the .NET Framework class library. In this way, your programs can be very small compared to earlier Windows applications; because you can rely on the millions of lines of code already written in the class library, not everything has to be in your application's executable (EXE) file.
All this assumes that you're working on a machine that has the .NET framework, and therefore the CLR and the .NET Framework class library, installed. The code for all elements we use in a VB .NET application-forms, buttons, menus, and all the rest-all comes from the class library. And other Visual Studio applications use the same class library, making it easy to mix languages in your programming, even in the same application. Also, distributing applications is easier, because all the support you need is already on the machine you're installing your application to.
As mentioned, the .NET framework organizes its classes into namespaces. For example, the .NET framework includes the namespaces Microsoft.VisualBasic, Microsoft.JScript, Microsoft.CSharp, and Microsoft.Win32. In fact, these namespaces contain relatively few classes; the real way we'll interact with the .NET framework class library in this book is through the System namespace.
The System Namespaces
You can't build a VB .NET application without using classes from the .NET System namespace, as we'll see over and over again in this book. When you want to use a Windows form, for example, you must use the System.Windows.Forms. Form class. A button in a Windows form comes from the System.Windows. Forms.Button class, and so on. There are many such classes, organized into various namespaces like System.Windows.Forms. Here's an overview of some of those namespaces:
System-Includes essential classes and base classes that define commonlyused data types, events and event handlers, interfaces, attributes, exceptions, and so on.
System.Collections-Includes interfaces and classes that define various collections of objects, including such collections as lists, queues, arrays, hash tables, and dictionaries.
System.Data-Includes classes that make up ADO.NET. ADO.NET lets you build data-handling components that manage data from multiple distributed data sources.
System.Data.OleDb-Includes classes that support the OLE DB .NET data provider.
System.Data.SqlClient-Includes classes that support the SQL Server .NET data provider.
System.Diagnostics-Includes classes that allow you to debug your application and to step through your code. Also includes code to start system processes, read and write to event logs, and monitor system performance.
System.Drawing-Provides access to the GDI+ graphics packages that give you access to drawing methods.
System.Drawing.Drawing2D-Includes classes that support advanced two-dimensional and vector graphics.
System.Drawing.Imaging-Includes classes that support advanced GDI+ imaging.
System.Drawing.Printing-Includes classes that allow you to customize and perform printing.
System.Drawing.Text-Includes classes that support advanced GDI+ typography operations. The classes in this namespace allow users to create and use collections of fonts.
System.Globalization-Includes classes that specify culture-related information, including the language, the country/region, calendars, the format patterns for dates, currency and numbers, the sort order for strings, and so on.
System.IO-Includes types that support synchronous and asynchronous reading from and writing to both data streams and files.
System.Net-Provides an interface to many of the protocols used on the Internet.
System.Net.Sockets-Includes classes that support the Windows Sockets interface. If you've worked with the Winsock API, you should be able to develop applications using the Socket class.
System.Reflection-Includes classes and interfaces that return information about types, methods, and fields, and also have the ability to dynamically create and invoke types.
System.Security-Includes classes that support the structure of the common language runtime security system.
System.Threading-Includes classes and interfaces that enable multithreaded programming.
System.Web.Security-Includes classes that are used to implement ASP.NET security in Web server applications.
System.Web.Services-Includes classes that let you build and use Web services, programmable entities on Web Server that code can communicate with using standard Internet protocols.
System.Windows.Forms-Includes classes for creating Windows-based forms that make use of the user interface controls and other features available in the Windows operating system.
System.Xml-Includes classes that support processing of XML.
These, along with the many other System classes, form the foundation on which VB .NET applications rest. It's time now to start taking a look at how to build those applications.
This policy contains information about your privacy. By posting, you are declaring that you understand this policy:
- Your name, rating, website address, town, country, state and comment will be publicly displayed if entered.
- Aside from the data entered into these form fields, other stored data about your comment will include:
- Your IP address (not displayed)
- The time/date of your submission (displayed)
- Your email address will not be shared. It is collected for only two reasons:
- Administrative purposes, should a need to contact you arise.
- To inform you of new comments, should you subscribe to receive notifications.
- A cookie may be set on your computer. This is used to remember your inputs. It will expire by itself.
This policy is subject to change at any time and without notice.
These terms and conditions contain rules about posting comments. By submitting a comment, you are declaring that you agree with these rules:
- Although the administrator will attempt to moderate comments, it is impossible for every comment to have been moderated at any given time.
- You acknowledge that all comments express the views and opinions of the original author and not those of the administrator.
- You agree not to post any material which is knowingly false, obscene, hateful, threatening, harassing or invasive of a person's privacy.
- The administrator has the right to edit, move or remove any comment for any reason and without notice.
Failure to comply with these rules may result in being banned from submitting further comments.
These terms and conditions are subject to change at any time and without notice.
- Data Science
- React Native
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews
Changes in Controls from VB6 to VB.net
Throwing a Custom Exception in VB.net
Throwing an Exception in VB.net
Using Multiple Catch Statements in VB.net
Exception Filtering in the Catch Block in VB.net
Raising an Exception Intentionally in VB.net
Getting an Exception's Number and Description in VB.net
Using On Error GoTo 0 in VB.net
Using Resume Next and Resume Line in VB.net
Preserving a Variable's Values between Procedure Calls in VB.net
Specifying Optional Arguments with default values in Procedures in VB.net