Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and...

40
Tutorial 11 1 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented programming and Web applications programming Visual Basic.NET introduces Web forms that bring the same design principles and level of productivity to mobile Web applications

Transcript of Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and...

Page 1: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 1

The Visual Studio.NET Environment

The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented programming and Web applications programming

Visual Basic.NET introduces Web forms that bring the same design principles and level of productivity to mobile Web applications

Page 2: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 2

The Visual Studio.NET Environment

Page 3: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 3

Identify the Components of Visual Studio.NET and the new IDE

The Visual Studio.NET IDE has a new, customizable look that integrates Visual Basic and the other Microsoft programming languages

This common IDE also provides better debugging throughout the project

The real strength of the common IDE is in its support for Web applications

Page 4: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 4

Identify the Components of Visual Studio.NET and the new IDE

Page 5: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 5

Modify Your Profile in the Visual Studio.NET IDE

The new Visual Studio.NET IDE allows you to customize various program settings such as keyboard scheme, window layout, and help filter

This collection of customized preferences is called a profile

Page 6: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 6

Modify Your Profile in the Visual Studio.NET IDE

Page 7: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 7

Modify Your Profile in the Visual Studio.NET IDE

Like Visual Basic 6.0, the new IDE provides a Toolbox where various programming elements are stored

Page 8: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 8

Customizing the New Visual Studio.NET IDE

You can customize many of the IDE’s menu features

Customization of the IDE allows you, as a developer, to set the IDE to your particular needs, making you both more efficient and effective in your application development, since you will not need to reset the IDE each time you enter the environment

Page 9: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 9

Customizing the New Visual Studio.NET IDE

Page 10: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 10

Customizing the New Visual Studio.NET IDE

Page 11: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 11

Using Solution Explorer

New to the IDE are solutions, which are containers for specific project types at each of the logical application tiers

The IDE shows these project types in the Solution Explorer, which displays a list of all the projects that are part of the current solution along with their corresponding files and directories

A solution can include several projects, even if they are written in different programming languages

Page 12: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 12

Using Solution Explorer

Page 13: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 13

Working with Dynamic Help

The Dynamic Help window allows you to

access context-sensitive help with one

click

The Dynamic Help feature tracks the

actions you have made while in the IDE

Page 14: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 14

Working with Dynamic Help

Page 15: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 15

Using the Task List

The Task List feature was formerly available only to developers working in Visual InterDev and Visual J++

It allows you to mark code with comments related to tasks that need to be done

Page 16: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 16

Using the Task List

Page 17: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 17

The Command Window

In the new Visual Studio.NET IDE Command Window, you can perform search and replace operations across the Visual Studio.NET environment using the find, navigate, and execute features—all in a single input line

Page 18: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 18

Starting Visual Basic.NET

The first step of building any Visual Basic.NET application is to start Visual Basic

Page 19: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 19

Starting Visual Basic.NET

Page 20: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 20

Using Windows Forms

Windows Forms replaces the Visual Basic Form that you used to create program interfaces in Visual Basic 6.0

Windows Forms provides improved features that make it easier for you to create interfaces for your Visual Basic programs

Windows Forms provides a standard development platform across the different languages supported by Visual Studio.NET

Page 21: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 21

Viewing Code in Windows Forms

At first glance, you will see that Visual Basic.NET Windows Forms looks similar to the Visual Basic 6.0 Form

Unlike Visual Basic 6.0, the new form module contains all of the code to instantiate the form and the runtime instance of the controls created on the form

Page 22: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 22

Viewing Code in Windows Forms

Page 23: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 23

Differences Between Visual Basic.NET Windows Forms and Visual Basic 6.0

Forms

Windows Forms is compatible with the forms package in Visual Basic 6.0

The key differences are as follows:There is no shape control in Windows Forms

There is no line control in Windows Forms

As you learned in Tutorial 6, Lesson B, in Visual Basic 6.0, there was one menu control, called Menu. Menu could be opened as a MainMenu or ContextMenu

Visual Basic.NET Windows Forms does not support the Form.PrintForm method

Page 24: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 24

Setting Appearance Properties

You will work in the Visual Basic.NET

Design View and experiment with

properties of controls

Page 25: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 25

Adding a Label Control to the Windows Forms Calendar Application

The first control you will work with in Visual Basic.NET is the label control

Page 26: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 26

Adding a Label Control to the Windows Forms Calendar Application

Page 27: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 27

Adding Picture, Text, and Frame Controls

In the Windows Forms application, the functionality of Visual Basic 6.0 controls still exists; however, the names, various properties, and methods have been changed

Page 28: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 28

Adding ActiveX Calendar, Date, and Time Controls

The DateTimePicker and MonthCalendar are ActiveX intrinsic controls included in Visual Basic.NET—they are built right into the core Visual Basic.NET code

You never have to add them to the Toolbox

Page 29: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 29

Adding a Button Control and Code

You will use the Visual Basic.NET Button control to handle this task

Now that you have added the button to the form, you must program it with the appropriate message using the procedures outlined at the top of page 828 of the textbook

Page 30: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 30

Visual Basic 6.0 and Visual Basic.NET: Differences in Coding

Visual Basic.NET is now truly an object-oriented programming language with true object class inheritance

You will programmatically add functionality to the Button control you just created

In Visual Basic 6.0, the programmer did not see the code for many controls

Visual Basic 6.0 automatically added to the program the references to the control instances created on the form

Page 31: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 31

Visual Basic 6.0 and Visual Basic.NET: Differences in Coding

Page 32: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 32

Completing the Code for the Button

Now you will add the code that displays the textbook and the message that appears when the button is clicked

To make the button on your Pets Online application functional, you will need to enter code in your calendar application as shown on page 829 of the textbook

Page 33: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 33

Variable Declarations in Visual Basic.NET

In Visual Basic.NET, all variables in a single Dim statement must have the same type and that type need only be declared after the last variable is declared

In Visual Basic.NET, however, the scope of a variable is restricted to the smallest area possible

Variables are declared only when they are first used

This allows variables to be limited to parts of procedures

Page 34: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 34

Passing Parameters in Visual Basic.NET

In Visual Basic.NET, the parameters are passed ByVal by default, with the exception of references to classes, interfaces, and arrays, which are still passed ByRef by default

To test the button perform the two procedures listed on pages 830 and 831 of the textbook

Page 35: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 35

Adding a Link Label to the Windows Forms Calendar Application

Pets Online wants its customers to be able to click a link to its online catalog

You can use the new Visual Basic.NET LinkLabel control to do this

This control, like other new controls—such as Tray Icon and Print Preview—are new to Visual Basic.NET and provide additional common functionality for developers

The LinkLabel control allows you to create and add Web-style links on your Windows Forms applications

Page 36: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 36

Adding a Link Label to the Windows Forms Calendar Application

Page 37: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 37

Adding a Menu and Menu Items

With the new Visual Basic.NET Menu Designer control, you can quickly and easily add menus to Windows Forms application, modify them, and view them without having to run the application

Page 38: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 38

Adding a Menu and Menu Items

You will need to also add the code for the Click event for the Exit option

When the user clicks this option on the menu, the application should use the Close statement to Close the form

Page 39: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 39

Printing Windows Forms Application Code

To print the code:

Verify that you are in Code View

From the IDE menu bar, select File, Page Setup. Select the Line numbers check box to number the code lines for reference

Click OK

From the menu bar, select File, Print and click OK

Page 40: Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.

Tutorial 11 40

Saving and Exiting a Windows Forms Application

You should save all the components of this application before you exit Visual Basic.NET

If you are distributing your application to a user, you will need to give the user a copy of the calendar.exe file and a copy of the Visual Basic runtime file (msvbvm6.0.dll), just as you do with Visual Basic 6.0