Wal Mart Online → Best Selection
WM468X60_ko_static.gif

Last Modified:
1-5-2012

Home


Visual Basic

Introduction to VB.NET

.NET Framework

VS2008 IDE

How VB is Compiled

Start Visual Studio


Windows Form App


Save Your Work

VB OOP Programming

Visual Basic Code


Exit Code


Button Event Code

Coding Recommendations

If/Then/Else

Error List Window

Comment Syntax

Help Window

Language Essentianl

Built-In Data Types


Declare Variables

Declare Constants

Code Arithmetic Expressions

Assignment Statements

Operator Precedence

Type Casting


Math Class

String Declaration

Conversion Functions

Conversion Methods

Formatting Functions

String Formatting


Variable Scope

Enumerations

Nullable Types


Loop Constructs

For Next Loop

Do While Loop


Do Until Loop

Do...Loop-While

Do...Loop-Until


Exit Do | Exit For

Do...Loop


Nested Loops


Arrays

Array Declaration


Rnd( ) Function

Listbox Control


KeyPressEventArgs


Parallel Arrays

Key Event Args


Dynamic Arrays

Redimension Array

Set Breakpoint

Start Debugger


ReDim Preserve


MultiDimensional Arrays

DataGridView Control


Length and Sort Methods


Structures

Pad Right

Split Method

IsNumeric Function


Multiform Projects


Add Form To Project

Form Object Methods

Form Show Method

ShowDialog Method

Form Close Method

Form Accept Button

Multiform Project Example


ASP.NET Web Programming

Create Data Source


Configure Access Data Source


Add Product Class


Extract Local Database Data

Order PageLoad VB Code

Add New Web Page


Set Start Page

Display Cart Aspx Code

Display Cart Design View

Sorted List Definition

VB.NET Session State


Create CartItem Class

GetCartContents Function


Add To Cart Event Handler

Remove Cart Item Event


Clear Cart Event Handler



How to Think Straight About Psychology

by Keith E. Stanovich



* ISBN: 9780205685905
* ISBN10: 0205685900
* Publisher: Pearson
* Publish date: 2009-07-01
* Ebook Rental Only
* $23.99
* Free Shipping
* Available 1-11-2012
* 180 Day Activation

You can use Visual Studio for developing the two types of applications:

  1. A Windows Forms Application: A WinForms app is a type of Windows Application that runs on the user's PC. Each Windows form in the application provides a user interface that lets the user interact with the application.
    • As part of the user interface, a Windows Forms application uses Windows forms controls. For instance, the form controls can use radio buttons, labels, text boxes, and buttons. In the next section we begin to develop Windows Forms Applications.
  2. Web Forms Applications: Like a Windows Forms Application, a web application consists of one or more web forms that can contain controls. Unlike Windows forms, web forms are accessed by and displayed in a Web Browser such as Internet Explorer, Firefox and Google Chrome.
    • As part of the user interface, a web form uses Web Form Controls. These controls are similar to the Windows Forms controls, but they work only with web forms.
    • In contrast to a Windows Forms application, which runs on the user's PC, the code for a Web Forms application runs on a web server. As this code is executed, it passes the visual portion to the browser running on the client in the form of HTML. The browser then interprets the HTML and displays the form.

The .NET Framework

A detailed view of the .NET Framework is given in Figure VB-1:

Net Framework

Figure VB-1: Detailed View of Microsoft .NET Framework


Description

  • Windows Forms applications do not access the operating system or computer hardware directly. Instead, they use services of the .NET Framework, which in turn accesses the operating system and hardware.
  • The .NET Framework consists of two main components of the .NET Framework Class Library and Common Language Runtime.
  • .NET Framework Class Libary: Provides files that contain pre-written code known as classes that are available to all of the .NET programming languages. This class library consists of thousands of classes, but you can create simple .NET applications once you learn how to use just a few of them.
  • Common Language Runtime: Manages the execution of .NET programs by coordinating esssential functions such as memory management, code execution, security, and other services. Because .NET applications are managed by the Common Language Runtime, they are called managed applications
  • .
  • Common Type System: A component of the Common Language Runtime that ensures that all .NET applications use the same basic data types no matter what programming languages are used to develop the applications.

As you can see, the .NET Framework provides a common set of services that application programs written in a .NET language such as C# can use to run on various operating systems and hardware platforms. The .NET Framework is divided into two main components:

  1. The .NET Framework Class Library.
  2. The Common Language Runtime.

The .NET Framework Class Library consists of segments of pre-written code called classes that provide many of the functions that you need for developing .NET applications. For instance, the Windows Forms that you need for developing .NET applications. For instance, the Windows Forms classes are used for developing Windows Forms applications. The ASP.NET classes are used for developing Web Forms applications. And other classes let you work with databases, manage security, access files, and perform many other functions.

Although it's not apparent in this figure, the classes in the .NET Framework Class Library are organized in a hierarchical structure. Within this structure, related classes are organized into groups called namespaces. Each namespace contains the classes used to support a particular function. For example, the System.Windows.Forms namespace contains the classes you use to access data.

Visual Studio Integrated Development Environment IDE

Visual Studio IDE

Figure VB-2: Visual Studio Integrated Development Environment IDE


Figure VB-2 shows the Microsoft Visual Studio Integrated Development Environment. In practice, this IDE if often referred to as Visual Studio. Microsoft Visual Studio supports 3 languages: Visual Basic, Visual C#, and Visual C++.

Microsoft Visual Studio includes designers that can be used to design the user interface for Windows Forms and Web Forms applications. The visual tools make this tough task much easier. You'll be introduced to the designer for Windows Forms.

Visual Studio also includes an editor that can be used to work with any of the three languages presented in Figure VB-1 as well as HTML and XML. This editor contains many features that make it easy to enter and edit the code for an application.

Description

  • The Visual Studio IDE is often referred to as Visual Studio, even though that name is also used to refer to the suite of products, including the .NET Framework.
  • Visual Studio supports Visual Basic, Visucal C++, and Visual C#.
  • Visual Studio includes designers that can be used to develop Windows Forms applications and Web Forms applications.
  • Visual Studio includes a code editor that can be used to work with all 3 languages as well as HTML and XML.

How A Visual Basic Application is compiled and Run

VB Compiled & Run

Figure VB-3: How a Visual Basic Program is Compiled and Run


Figure VB-3 shows how a Visual Basic program is compiled and run. To start, you use Visual Studio to create a project, which is made up of source files that contain Visual Basic statements. A project may also contain other types of files, such as sound, image or text files.

After you enter the Visual Basic code for a project, you use the Visual Basic Compiler, which is built into Visual Studio, to build or compile your Visual Basic source code into Microsoft Intermediate Language.

At this point, the Intermediate Language is stored on disk in a file that's called an assembly. In addition to the Intermediate Language, the assembly includes references to the classes that the application requires. The assembly can then be run on any PC that has the Common Language Runtime installed on it. When the assembly is run, the Common Language Runtime converts the Intermediate Language to native code that can be run by the Windows operating system.

If you have developed applications with other languages, this process should be familiar to you. If this is your first language, though, you will not really understand this process until you develop your first applications.

Incidentally, a solution is a container that can hold one or more projects. Although a solution can contain more than one project, the solution for a simple application usually contains just one project. In that case, the solution and the project are essentially the same thing.

Operation

  1. The programmer uses Visual Studio to create a project which includes Visual Basic source files. In some cases, a project will also contain other types of files, such as graphic image or sound files.
  2. The Visual Basic compiler translates the Visual Basic source code for a project into Microsoft Intermediate Language. This language is stored on disk in an assembly that also contains references to the required classes. An assembly is an executable file that has an .exe or .dll extension.
  3. The assembly is run by the .NET Framework's Common Language Runtime. The Common Language Runtime manages all aspects of how the assembly is run, including converting the Intermediate Langauge to native code that can be run by the operating system, managing memory for the assembly, and enforcing security.

How Visual Basic differs from the other .NET languages

Visual Basic uses the same .NET Framework classes as the other .NET programming languages. These classes affect almost every aspect of programming, including creating and working with forms and controls, using databases, and working with basic language features such as arrays and strings. In addition, Visual Basic works has many similarities to the other .NET languages. The main difference is the syntax of the language.

A Tour of the Visual Studio Integrated Development Environment

With all that as background, we're ready to take a tour of the Visual Studio IDE. Along the way, we'll touch on some basic techniques for working in this environment. We'll also go over how some of the terms we just went over are applied within the Integrated Development Environment.

How To Start Visual Studio

Select Start → All Programs from your Windows main screen as indicated in the diagram below:

Start All Programs

Figure VB-4: Start → All Programs


All programs will display a list of Program folders:

  1. Expand the Visual studio Folder by left-clicking the folder icon.
  2. Start the Visual Studio Application by left-clicking the Visual Studio icon as indicated in the diagram below:

Visual Studio Application

Figure VB-5: Start Visual Studio Application


When the Visual Studio program starts the Start Screen should look similar to the diagram below:

Visual Studio Start Screen

Figure VB-6: Visual Studio Start Screen