17
Visual Basic .NET Programming The Visual Studio .NET IDE * Property of STI Page 1 of 17 TOPIC TITLE: The Visual Studio .Net Integrated Development Environment (IDE) Specific Objectives: At the end of the topic session, the students are expected to: Cognitive: 1. Differentiate the IDE of VB .NET from VB6. 2. Create Visual Basic .NET projects. 3. Set Project References and Properties . 4. Identify various IDE features. 5. Debug applications . Affective: 1. Listen to others with respect. 2. Participate in class discussions actively. MATERIALS/EQUIPMENT: o topic slides o OHP TOPIC PREPARATION: o Have the studen ts research on the: § Differences between VB .Net and VB 6 IDE o It is imperative for the instructor to incorporate various kinds of teaching strategies while discussing the suggested topics. The instructor may use the suggested learning activities below to facilitate a thorough and creative discussion of the topic. o Prepare the slides to be presented in the class. TOPIC PRESENTATION: The topic will revolve around Visual Studio .NET IDE. This will be the suggested flow of discussion for the course topic: 1. Introduce the topics to be covered in this session. 2. Ask the students to share their research about the differences between VB.Net and VB6 IDE. 3. Discuss the enhancements in previous IDEs of Visual Basic . 4. Show the slide about the VB .Net Integrated Development Environment (IDE). 5. Demonstrate how to start VB .Net. 6. Enumerate and explain each template in creating different VB.Net projects. 7. Discuss how to create Windows Application project. 8. Discuss how to set references in the project. 9. Describe the Application pr operties of the project as well as the Compile properties. 10. Describe the VB.Net IDE basic features. 11. List the Development Environment features and discuss how to use it. 12. Explain how to debug applications by setting breakpoints and debugging the codes. A sample code is provided for debugging demonstration. 13. Remind the students that they will have their quiz next meeting.

MELJUN CORTES Vb.net handout visual studio net ide

Embed Size (px)

Citation preview

Page 1: MELJUN CORTES Vb.net handout visual studio net ide

Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI Page 1 of 17

TOPIC TITLE: The Visual Studio .Net Integrated Development Environment (IDE) Specific Objectives: At the end of the topic session, the students are expected to: Cognitive:

1. Differentiate the IDE of VB .NET from VB6. 2. Create Visual Basic .NET projects. 3. Set Project References and Properties . 4. Identify various IDE features. 5. Debug applications .

Affective:

1. Listen to others with respect. 2. Participate in class discussions actively.

MATERIALS/EQUIPMENT:

o topic slides o OHP

TOPIC PREPARATION:

o Have the studen ts research on the: § Differences between VB .Net and VB 6 IDE

o It is imperative for the instructor to incorporate various kinds of teaching strategies while discussing the suggested topics. The instructor may use the suggested learning activities below to facilitate a thorough and creative discussion of the topic.

o Prepare the slides to be presented in the class.

TOPIC PRESENTATION: The topic will revolve around Visual Studio .NET IDE. This will be the suggested flow of discussion for the course topic:

1. Introduce the topics to be covered in this session. 2. Ask the students to share their research about the differences

between VB.Net and VB6 IDE. 3. Discuss the enhancements in previous IDEs of Visual Basic . 4. Show the slide about the VB .Net Integrated Development

Environment (IDE). 5. Demonstrate how to start VB .Net. 6. Enumerate and explain each template in creating different

VB.Net projects. 7. Discuss how to create Windows Application project. 8. Discuss how to set references in the project. 9. Describe the Application pr operties of the project as well as the

Compile properties. 10. Describe the VB.Net IDE basic features. 11. List the Development Environment features and discuss how to

use it. 12. Explain how to debug applications by setting breakpoints and

debugging the codes. A sample code is provided for debugging demonstration.

13. Remind the students that they will have their quiz next meeting.

Page 2: MELJUN CORTES Vb.net handout visual studio net ide

Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI Page 2 of 17

The Visual Studio .Net IDE Page 1 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 1 of 30

The Visual Studio .Net IDE

c Differences between VB.Net and VB6 IDE

c Creating Visual Basic .NET Projects

c Setting Project References

c Using Development Environment Features

c Debugging Applications

The Visual Studio .Net IDE These are the topics to be discussed under Visual Studio.NET Integrated Development Environment (IDE):

o Differences between VB.Net and VB6 IDE o Creating Visual Basic .NET Projects o Setting Project References o VB.Net IDE Basic Features o Debugging Applications

[The Visual Studio .Net IDE Page 1 of 30]

Differences between VB.Net and VB6 IDE Page 2 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 2 of 30

c There is one IDE for all .NET projects

c Solutions can contain multiple programming language

c The IDE is customizable through “My Profile”

c The IDE has a built-in Internet browser

Differences between VB.Net and VB6 IDE

Differences between VB.Net and VB6 IDE Visual Studio .NET IDE provides some significant enhancement to previous IDEs of Visual Basic.

• There is one IDE for all Microsoft .NET projects.

The Visual Studio .NET IDE provides a single environment where you can develop all types of .NET applications, from simple applications based on Microsoft Windows, to complex n-tier component systems and complete internet applications.

• Solutions can contain multiple programming languages. You can incorporate multiple programming languages within one solution and edit all your code within the same IDE.

• IDE is customizable through My Profile

The IDE is fully customizable through the My Profile configuration section on the Visual Studio .NET Start Page.

• The IDE has a built-in Internet browser.

You can browse the Internet within the IDE, enabling you to look up online resources without moving between multiple application windows.

[Differences between VB.Net and VB6 IDE, Page 2 of 30]

The IDE Start Window To start Microsoft Visual Studio, click Start button, point to All Programs or Program Files , point to Microsoft Visual Studio 2005 then click Microsoft Visual Studio 2005. The following start window appears .

Page 3: MELJUN CORTES Vb.net handout visual studio net ide

Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI Page 3 of 17

The IDE Start Window Page 3 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 3 of 30

c Start Window

The IDEStart Window

Figure 2.1 – The IDE Start Window

[The IDE Start Window , Page 3 of 30]

Choosing a Project Template Page 4 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 4 of 30

Choosing a Project Template

c Visual Studio Templates

Choosing a Project Template Page 5 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 5 of 30

Choosing a Project Template

Windows services that will run continuously regardless of whether a user is logged on or not

Windows Service

Console application that will run from a command line

Console Application

User-defined Web controls that can be reused on Web page

Web Control Library

User-defined Windows control projects

Windows Control Library

Class libraries that provide similar functionality to Microsoft Active X DLL

Class Library

Standard Windows-based applications

Windows Applications

Use this template to create:Template

Choosing a Project Template To make a new project, from the Start Page window, click File , and then select New Project. The New Project dialog box appears where the templates installed for Visual Studio are displayed .

Figure 2.2 – New Project Dialog Box

The templates available for Visual Studio are the following:

• Windows Application – This template is used for creating Standard Windows-based applications. Windows applications are much more complex than console applications and can take advantage of the full suite of menus, controls, and other widgets you've come to expect in a modern desktop application. Examples of Windows applications are Microsoft Word or Excel.

• Class Library – This template is used for creating Class Library

to use in another application and for creating Class libraries that provide similar functionality to Microsoft Active X DLL.

• Console Application – This template is used for creating

command line application.

• Windows Control Library – This template is used for creating User-defined Windows control projects.

Page 4: MELJUN CORTES Vb.net handout visual studio net ide

Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI Page 4 of 17

• Web Control Library – This template is used for creating User-

defined Web controls that can be reused on Web page.

• Windows Service – This template is used for creating Windows services that will run continuously regardless of whether a user is logged on or not.

• Empty Project – This template is used for creating Empty

Windows Application project. Note: The Crystal Report is not a default template for Visual Studio. It so happened that in the computer where this screen was captured, this template is installed. [Choosing a Project Template, Pages 4-5 of 30]

Analyzing Project Structures Page 6 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 6 of 30

Analyzing Project Structures

c What follows are the files contained in every VB .Net project:

q Solution files (.sl n, ? suo)

q Project files (.vbproj)

q Local project items (.vb)

q Web project items (.aspx, .asmx, .asax)

Analyzing Project Structures Every project contains a variety of files unique to the type of project. To simplify management, the project files are usually stored within the same project directory.

• Solution Files (.sln, .suo) The .sln extension is used for solution files that link one or more projects together, and are also used for storing certain global information. The .suo file extension is used for Solution User Options files that accompany any solution records and any customizations you make to your solution. This file saves your settings such as breakpoints and task items so that they are retrieved each time you open the solution.

• Project Files (.vbproj) The project file is an Extensible Markup Language (XML) document that contains references to all project items, such as forms and classes in addition to project references and compilation options.

• Local Project Items (.vb) Previous versions of Visual Basic use different file extensions to distinguish between classes (.cls), forms (.frm), modules (.bas) and user controls (.ctl). Visual Basic .NET enables you to mix multiple types within a single .vb file.

• Web Project items (.aspx, .asmx, .asax) Web projects store their items in a Web server virtual directory and in an offline cache. Like local project items, Web project items also use the .vb file extension for classes and modules. However, Web project items include Web-specific files, such as .aspx for Web forms, .asmx for XML Web Services, and .asax for global application classes.

[Analyzing Project Structures, Pages 6 of 30]

Page 5: MELJUN CORTES Vb.net handout visual studio net ide

Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI Page 5 of 17

Creating VB .NET Projects Page 7 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 7 of 30

Creating VB .NET Projects

c Assemblies

q one or more files that make up a Visual Studio Application

q key concept in .NET development

q serve as building block for all .NET applications.

c Namespaces

q used in .NET Framework assemblies

q organize classes, interface and modules into a structure that is easy to understand

Creating Visual Basic .NET Projects Assemblies As you create and compile Visual Basic .NET Project, Assemblies are created automatically. An assembly is one or more files that make up a Visual Studio .NET application. These files include .exe or .dll and resources files such as graphics files. Assemblies are a key concept in .NET development, they serve as a building block for all .NET application Namespace Namespaces are used in .NET Framework assemblies to organize the objects of an assembly (classes, interfaces, and modules) into a structure that is easy to understand. Namespaces group logically relate d objects together so that you can easily access them in your Visual Basic .NET code. For example, the SQLClient namespace define within the System.Data assembly provides the relevant objects required to use a Microsoft SQL Server database. [Creating V B .NET Projects, Page 7 of 30]

Creating Windows Application Project Page 8 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 8 of 30

Creating Windows Application Project

c File > New Projectc select the Windows Application template

c type a name for the project then click OK

Creating Windows Application Project To create a Windows Application project, you must create first a new solution. To create a new solution:

1. From the File menu, click New Project. The New Project dialog bow appears.

2. Select the Windows Application template. 3. Type a name for your application in the Name textbox. 4. Click OK.

Figure 2.3 - The Visual Studio .NET IDE

[Creating Windows Applicat ion Project, Page 8 of 30]

Page 6: MELJUN CORTES Vb.net handout visual studio net ide

Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI Page 6 of 17

Setting Project References Page 9 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 9 of 30

Setting Project References

c Adding Referencesq select the current project in Solution

Explorer then Project > Add Reference

q click .NET, COM, or Projects tabq locate the required component in the list

• you may click the Browse tab to locate the file

q repeat step 3 for all the components you require, and then OK

Setting Project References You can set project references to other applications or code libraries in order to use the functionality these applications provide. You can set project references to other .NET assemblies, existing COM components, or other .NET projects within the same .NET solution. To add a reference: 1. Select the current project in Solution Explorer pane. On the Project

menu, click Add Reference. The Add Reference dialog box appears.

Figure 2.4 – Add Reference dialog box

2. In the Add Reference dialog box, select the appropriate type of

reference by clicking the .NET, COM, or Projects tab. 3. Locate the required component in the list, or if item is not displayed

in the list , use the Browse tab to locate the file. Click the item in the list, and then click OK.

4. Repeat step 3 for all the components you require, and then click OK.

[Setting Project References, Page 9 of 30]

Setting Project Properties Page 10 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 10 of 30

Setting Project Properties

c Application Property Settings:q Assembly nameq Root namespaceq Application typeq Startup objectq Assembly Information

Setting Project Properties You can specify many project properties in the project Property Window. These properties affect how the project behaves both in the IDE and after it is compiled. To show the Project Properties, click Project menu then click [Project Name] Properties. Some of the most common properties are: Applica tion Properties

1. Assembly name. Give the name of the assembly when the application is compiled into an .exe or .dll file.

2. Root Namespace. Change the root namespace without affecting the name of the assembly. This property affects any fully qualified names used for variable declaration.

3. Application type. Choose what type of assembly is generated when your project is compiled. You can select Windows Application (.exe), Console Application (.exe) or Class Library

Page 7: MELJUN CORTES Vb.net handout visual studio net ide

Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI Page 7 of 17

Setting Project Properties Page 11 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 11 of 30

Setting Project Properties

c Compile Property Settings:q Build output pathq Option explicitq Option Strict

(.dll). 4. Startup form. Select an entry point for your application. This is

usually the main form of your application or a Sub Main procedure.

5. Assembly Information. Give the name of the Title, Description, Company, Product, Copyright, Trademark, Assembly version and File version. It also specifies the GUID (Globally Unique Identifier) and the Neutral language of the project.

Figure 2.5 – Project Properties

Compile Properties

1. Build output path. Specifies the path location of the application when it is build or compiled.

2. Option explicit. If set to ON, this option forces you to declare all variables you will use.

3. Option Strict. If set to ON, i t provides strong typing and prevents unintended type conversions with data loss and disallows late binding .

Figure 2.6 – Compile Properties

[Setting Project Properties, Page s 10-11 of 30]

Page 8: MELJUN CORTES Vb.net handout visual studio net ide

Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI Page 8 of 17

IDE Features Page 12 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 12 of 30

c Solution Explorer

c Object Browser

c Server Explorer

c Task List

c Dynamic Help

IDE Features

IDE Features Page 13 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 13 of 30

IDE Features

c Form Windowq where the controls that make up the user

interface are placed

IDE Features Page 14 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 14 of 30

IDE Features

c Code Windowq where the codes for forms, events and

methods are written, displayed and modified

IDE Features The VB .NET IDE contains several features that enable more efficient development of projects. These features which will be discussed later in the topic include:

o Solution Explorer o Object Browser o Server Explorer o Task List o Dynamic Help

Form Window It is where the controls that make up the user interface are placed.

Figure 2.7 – Form Window

Code Window It is where the codes for forms, events and methods are written, displayed and modified.

Figure 2.8 – Code Window

Page 9: MELJUN CORTES Vb.net handout visual studio net ide

Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI Page 9 of 17

IDE Features Page 15 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 15 of 30

IDE Features

c Toolboxq contains the objects and controls that can

be added to Windows Forms

IDE Features Page 16 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 16 of 30

IDE Features

c Component Trayq where non-visual components that do not

appear at run time are stored

IDE Features Page 17 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 17 of 30

IDE Features

c Properties Windowq where properties of an object selected at

design time are modified

Toolbox The Toolbox contains the objects and controls that can be added to Windows Forms applications. By default, the Toolbox displays the All Windows Forms, Common Controls, Containers, Menus & Toolbars, Data, Components, Printing, Dialogs, Crystal Reports (if installed) and General. To place a control onto a form, simply drag the selected control to the location of the form.

Figure 2.9 – Toolbox

Component Tray The Component Tray is used to store non-visual components that do not appear at run time.

Figure 2.10 – Component Tray

Properties Window Each object has its own unique set of properties. The Properties window allows the user to modify the properties of any object that is currently selected at design time. The default view for the Properties window is to display properties by Category. However, this can be changed to an

Page 10: MELJUN CORTES Vb.net handout visual studio net ide

Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI Page 10 of 17

IDE Features Page 18 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 18 of 30

IDE Features

c Auto Hideq “hides” windows from the main IDEq click the Auto Hide button on the

toolbar to toggle Auto Hide on and off

c Tabbed Documentsq this mode adds a tab to the top of the

main window for each open document or file

q click on the tab that represents the document to switch between open documents

alphabetical view of properties by clicking the Alphabetical button on the Properties window.

Figure 2.11 – Properties Window

Auto Hide The new Auto Hide feature allows you to “hide” windows from the main IDE where applications are developed . Every window that appears in the IDE has the Auto Hide feature. To toggle Auto Hide on and off, click the Auto Hide button (pushpin) on the toolbar for each window you want to hide.

Tabbed documents Visual Studio .NET has a tabbed document theme that adds a tab to the top of the main window for each document or file that opens . To switch between open documents, simply click on the tab that represents the document. To close a document or to navigate within the open documents, use the buttons on the upper right-hand corner of the main window.

Multiple Documents MDI Form is short for Multiple-document interface (MDI) applications which allow you to display multiple documents at the same time. Each document is displayed in its own window. VB .Net also allows users to work in an MDI environment similar to that

Page 11: MELJUN CORTES Vb.net handout visual studio net ide

Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI Page 11 of 17

IDE Features Page 19 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 19 of 30

IDE Features

c Multiple Documentsq MDI – Multiple Document Interfaceq display multiple documents simultaneouslyq to work in an MDI environment

• Tools> Options

• click Multiple documents on the Window layout section

• click O K

c Dockable windowsq all windows within the IDE can be docked

to any edge of the IDE by dragging them to any location

of VB6. To display forms in multiple documents layout:

1. From the Tools menu, click Options . The Options dialog box appears.

2. On the Window layout section, click the Multiple documents

radio button. 3. Click OK. The window forms are now displayed in MDI mode.

Dockable windows All windows within the IDE are dockable to any edge of the IDE. Simply drag any window to whatever location and it will lock into place. The combination of Auto Hide and Dockable windows allows complete customization of IDE workspace. [Using IDE Features, Pages 12-19 of 30]

Solution Explorer Page 20 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 20 of 30

c displays project hierarchy, project references, project items and any subfolders that contain project items

Solution Explorer

Solution Explorer Solution Explorer displays your project hierarchy, including all project references; project items such as forms, classes, modules and so on; and any subfolders that contain project items.

Figure 2.12 – Properties Window

Page 12: MELJUN CORTES Vb.net handout visual studio net ide

Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI Page 12 of 17

Solution Explorer Page 21 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 21 of 30

c “Show all Files ” mode

q click the Show all Files button to display the hidden files or those marked as excluded from the project

c Manipulating Projects

q Drag-and-drop editing

q Context menus

Solution Explorer

“Show All Files ” Mode By default, Solution Explorer only shows some of the files stored in the project hierarchy. Certain files, which do not form an integral part of the solution, may be hidden or marked as excluded from the project, such as the files in the bin and obj folders on the slides. These files become

visible when you click the Show All Files button. The following features allow you to manipulate your projects with Solution Explorer:

• Drag and Drop editing You can use drag-and-drop editing to move existing project items between folders.

Using Solution Explorer Most items provide context menus that allow you to perform standard actions, such as adding items to the project, deleting items from the project and excluding items from the project, which remove the file from the project but does not delete the file.

[Solution Explorer, Pages 20-21 of 30]

Server Explorer Page 22 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 22 of 30

Server Explorer

c Managing Data Connectionsq View > Server Explorer

c Adding a connectionq click Connect to Database on the

Server Explorer toolbar

Server Explorer In the previous versions of Visual Basic, you can manipulate databases by using the Data View window. Server Explorer provides the same functionality and additional functional ity for managing and using server components. Managing Data Connections To show the Server Explorer pane, click View on the Menu bar then click Server Explorer. The Server Explorer pane appears on the left of the window.

Figure 2.13 – Server Explorer

To use Server Explorer in manipulating a database, add a connection to

the server by clicking Connect to Database button on the Server Explorer toolbar. This action brings up the Choose Data Source dialog box.

Page 13: MELJUN CORTES Vb.net handout visual studio net ide

Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI Page 13 of 17

Server Explorer Page 23 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 23 of 30

Server Explorer

c select Data Source from the Data Source box then click the Continue button

c click Browse button to select a database file and enter the corresponding User name and Password of the database

c click Test Connection to check if the connection was successfully done

Upon selecting Data Source and clicking the Continue button, Add Connection dialog box will appear.

Click Browse button to select a database file and enter the corresponding User name and Password of the database, if any. Click the Test Connection to check if the connection was successfully done. After a connection is established, you can view and manipulate the database diagrams, tables, views, stored procedures, and functions. [Server Explorer, Pages 22-23 of 30]

Page 14: MELJUN CORTES Vb.net handout visual studio net ide

Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI Page 14 of 17

Object Browser Page 24 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 24 of 30

c View > Object Browser

Object Browser

Object Browser Page 25 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 25 of 30

c Using the VB .NET Object Browser, you can:q examine objects and their members within

a library

q access lower-level items

q examine how the .NET Framework class libraries use inheritance in their object hierarchies

ObjectBrowser

Object Browser

To show the Object Browser pane, click View on the Menu bar then click Object Browser or you can simply press <F2> for shortcut.

Figure 2.14 – Object Browser

Visual Basic .NET enhances the Object Browser found in previous versions of Visual Basic. Previous versions of the Object Browser show only a high level view of objects and their methods. Using the Visual Basic .NET Object Browser you can:

1. Examine objects and their members within a library, exploring the object hierarchy to find details about a particular method or item.

2. Access lower-level items, such as interfaces and object inheritance details.

3. Examine how the .NET Framework class libraries use inheritance in their object hierarchies.

[Object Browser, Pages 24-25 of 30]

Task List Page 26 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 26 of 30

c tasks are kept in the .suo project file so that information are not lost when the Visual Studio .NET is closed

c View > Other Windows > Task List

c Adding Task Listq type in the top row that is always visible to

the Task List windowq build your application to automatically add

tasks to the list q create comments in the code that use

specific token strings defined in the Options dialog box

Task ListWindow

Task List Tasks are kept in the .suo project file so that you do not lose information when you close your Visual Studio .NET session. The Task window aids programmers in keeping track of tasks related to the project. To view the Task List window, from the View menu, select Other Windows and then choose Task List. You can also use the s hortcut, <CTRL + ALT+ K>.

Figure 2.15 – Task List Window

Page 15: MELJUN CORTES Vb.net handout visual studio net ide

Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI Page 15 of 17

Tasks can be added to your Task List in three ways:

1. You can manually add tasks to the task list by typing in the top row that is always visible to the Task List window.

2. Visual Studio .NET automatically adds tasks to the list when you

attempt to build your application. This allows you to keep track of what you must do to successfully complete your project.

3. You can add tasks by creating comments in your code that use

specific token strings defined in the Options dialog box, which is accessible from the Tools menu.

[Using the Task List, Page 26 of 30]

Dynamic Help Page 27 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 27 of 30

c displays appropriate Help links to the .NET Help files

c changes topic depending on the location of the cursor

c Help > Dynamic Help

Dynamic Help

CheckBoxselected from the Toolbox

Button selected from the Toolbox

Dynamic Help The Dynamic Help window automatically displays appropriate Help links to the .NET Help files, depending on where the cursor is and what text is highlighted. MSDN must be installed in order to access this feature. To show the dynamic help window, click Help menu then click Dynamic Help. The Dynamic Help pane appears on the right below the Solution Explorer pane. Select a button control in the Toolbox pane and observe the changes in the Dynamic Window. Select another control of your choice and observe again the Dynamic Window.

Figure 2.16 – A Button is selected from the Toolbox

Figure 2.17 – A CheckBox is selected from the Toolbox

Dynamic Help automatically changes topic according to where the cursor is. [Using the Dynamic Help, Page 27 of 30]

Page 16: MELJUN CORTES Vb.net handout visual studio net ide

Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI Page 16 of 17

Designing VB .Net Application Page 28 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 28 of 30

Designing VB .NET Application

c Steps in creating a program in VB .Net.

q Create the interface

q Set properties

q Write the code

Designing VB .NET Application When a VB .Net application is run, a form along with its controls appear on the screen. Normally, nothing happens until the user takes an action, such as clicking a particular control in the form . Such an action is called an event. What follows are the steps in creating a program in VB .Net.

1. Create the interface – that is to create a form and add, position and size the necessary objects.

2. Set properties – that is to set the relevant properties for the objects.

3. Write the code – that is to create the code to be executed when the events takes place.

Notice that the steps are somewhat similar to that of designing a program in Visual Basic 6. [Designing VB .NET Application, Page 28 of 30 ]

Debugging Applications Page 29 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 29 of 30

Debugging Applications

c Setting Breakpoints q Ways

• click the margin to the left of the code window on the line containing the statement where debugger will halt

• Debug> New Breakpoint• place the cursor on the line where you want

the debugger to halt. Press <F9> to switch the breakpoint on and off.

c Debugging Codeq Step Intoq Step Over q Step Out

Debugging Applications Page 30 of 30

The Visual Studio .Net IDE

Visual Basic .NETProgramming

* Property of STIPage 30 of 30

Debugging Applications

c Sample Demonstration:q create a new projectq double -click the form to go to Code

windowq type following code on the Private Sub

Form1_Load event handler:

Dim X As IntegerDim Y As IntegerX = 10Y = X – 5MessageBox.Show(Y)

q place the pointer on the line Y = X – 5 then press <F9>

q press <F5>q place the pointer on the Y variableq press <F11> to Step into the codeq close the program

Debugging Applications Visual Studio .NET IDE provides enhanced versions of many of the debugging features found in previous versions of Visual Basic. Setting Breakpoints Breakpoints halt execution of code at a specific line. You can set breakpoints at design time or during a debugging session. There are several ways to set a breakpoint:

1. Click the margin to the left of the code window on the line containing the statement where you want the debugger to halt.

2. On the Debug menu, click New Breakpoint , and choose from the various options.

3. Place the cursor on the line where you want the debugger to halt. Press <F9> to switch the breakpoint on and off.

Debugging Code Debugging your code in Visual Basic .NET is similar to debugging code in previous versions of Visual Basic. When code execution stops at the breakpoint, you can step through the code by us ing the Debug menu or

the debugging buttons, Step Into , Step Over , Step Out , in the Standard toolbar. In Step Into, the application executes the current statement and enters the Break mode where the user can apply changes. Step Over is the same as Step Into, except that when it reaches a call for another procedure, it will not break into the procedure. Step Out is going back to the procedure it was called from. The following steps will demonstrate the debugging feature in a windows application project:

1. Create a new project. 2. Double-click the form to go to Code window. 3. Add the following code on the Private Sub Form1_Load event

handler:

Page 17: MELJUN CORTES Vb.net handout visual studio net ide

Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI Page 17 of 17

Dim X As Integer Dim Y As Integer X = 10 Y = X – 5 MessageBox.Show(Y)

4. Place the pointer on the line Y = X – 5 then press <F9> to toggle a breakpoint.

5. Run the program by pressing <F5>. This will halt execution in the Form1_Load on line Y = X – 5. The yellow highlight indicates the breakpoint or the line of code where the execution will halt.

6. Place the pointer on the Y variable and see the results that will pop up on the pointer.

7. Press <F11> to Step into the code and continue pressing until the program ends.

8. Close the program.

[Debugging Applications, Page s 29-30 of 30]

EVALUATION/GENERALIZATION:

• Visual Studio .NET Integrated Development Environment (IDE) is a Multiple Document Interface (MDI) application which consists of a parent window and multiple other windows, such as menus, toolbars, design and editing window, and other windows associated with the parent window.

• In creating VB.NET projects, we encountered assemblies and namespaces.

• Aside from adding references, we show how to set different project properties, such as application, compile and debug properties.

• We also show how to use the IDE features such as solution explorer, object browser, server explorer, task list, and dynamic help.

• The Visual Studio .NET IDE provides enhanced versions of many of the debugging features found in previous versions of Visual Basic.

REFERENCES:

• Microsoft Official Course, (2002), 2373B: Programming with

Microsoft Visual Basic .NET, Microsoft Corporation • Holzner, Steven, (2003), Sams teach yourself Microsoft Visual

Basic.Net 2003 in 21 days, USA, Sams Publishing • Jesse Liberty, (2002), Learning Visual Basic .NET, USA,

O'Reilly & Associates, Inc.