Microsoft Visual Basic 2010 Step by Step eBook

(Tina Meador) #1

Chapter 5 Visual Basic Variables and Formulas, and the .NET Framework 153


What is the purpose of the .NET Framework, anyway? The .NET Framework is a major feature
of Visual Studio that is shared by Visual Basic, Microsoft Visual C++, Microsoft Visual C#,
Microsoft F#, and other tools in Visual Studio. It’s an underlying interface that becomes part
of the Windows operating system itself, and it is installed on each computer that runs Visual
Studio programs. The key components in the .NET Framework are the common language
runtime (CLR) and the .NET Framework class library, which includes ADO .NET, ASP .NET,
Windows Forms, and Windows Presentation Foundation (WPF). With each version of Visual
Studio, the .NET Framework is extended to provide additional functionality. In Visual Studio
2010, the .NET Framework 4 library is being introduced, which offers an update to the .NET
Framework 3 .5 library and offers more deployment options, support for parallel computing
(multithreaded and asynchronous code), improved security, networking enhancements,
and new Web services supplied through ASP .NET.

Many of the improvements in the .NET Framework will come to you automatically as you
use Visual Basic 2010, and some will become useful as you explore advanced programming
techniques. Starting now and continuing throughout this book, I’ll teach you how to use
several methods in the .NET Framework to enhance your Visual Basic programs. After you
finish with this book, you may want to seek out additional books and resources about the
.NET Framework because it offers an important extension to what you can do with Visual
Basic and the other languages in Visual Studio.

Give the math methods in the .NET Framework a try now by completing the following
exercise.

Use the System .Math class to compute square roots


  1. On the File menu, click New Project.


The New Project dialog box opens.


  1. Create a new Visual Basic Windows Forms Application project named
    My Framework Math.
    The new project is created, and a blank form opens in the Designer.

  2. Click the Button control on the Windows Forms tab of the Toolbox, and then create
    a button object at the top of your form.

  3. Click the TextBox control in the Toolbox, and then draw a text box below the button
    object.

  4. Set the Text property of the button object to Square Root.

  5. Double-click the button object to display the Code Editor.

  6. At the very top of the Code Editor, above the Public Class Form1 statement, type the
    following program statement:


Imports System.Math
Free download pdf