MELJUN CORTES Vb.net_handout_visual Studio Net Ide

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 Environme nt (IDE) Specific Objectives:  At the end of the topic session , the stu dents are e xpecte d to: Cognitive: 1. Differentiate the IDE of VB .NET from VB6. 2. Creat e Visual Basic .NET projects. 3. Set Project References and Proper ties . 4. Identify various IDE f eatures . 5. Debu g applicat ions.  Affec tive : 1. Listen to others with respect. 2. Participat e in class discussions actively. MATERIALS/EQUIPMENT: o top ic slid es o OHP TOPIC PREPARATION: o Have the students re search on the: § Differences between VB .Net and VB 6 IDE o It is imperative for the instructor to incorp orate var ious 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 st udents to share their research abo ut the differences between VB.Net and VB6 IDE. 3. Discuss the enhancements in previous IDEs of Visual Basic . 4. Show the slide ab out 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 App lication 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.

Transcript of MELJUN CORTES Vb.net_handout_visual Studio Net Ide

Page 1: MELJUN CORTES Vb.net_handout_visual Studio Net Ide

8/8/2019 MELJUN CORTES Vb.net_handout_visual Studio Net Ide

http://slidepdf.com/reader/full/meljun-cortes-vbnethandoutvisual-studio-net-ide 1/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)

Speci f ic Object ives:

 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 students research on the:§  Differences between VB .Net and VB 6 IDE

o  It is imperative for the instructor to incorporate various kinds ofteaching strategies while discussing the suggested topics. Theinstructor 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 differencesbetween VB.Net and VB6 IDE.

3. Discuss the enhancements in previous IDEs of Visual Basic .

4. Show the slide about the VB .Net Integrated DevelopmentEnvironment (IDE).

5. Demonstrate how to start VB .Net.

6. Enumerate and explain each template in creating differentVB.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 anddebugging the codes. A sample code is provided for debuggingdemonstration.

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

Page 2: MELJUN CORTES Vb.net_handout_visual Studio Net Ide

8/8/2019 MELJUN CORTES Vb.net_handout_visual Studio Net Ide

http://slidepdf.com/reader/full/meljun-cortes-vbnethandoutvisual-studio-net-ide 2/17

  Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI

Page 2 of 17

The Visual Studio .Net IDEPage 1 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page1of30

T h e V i s u a l S t u d i o

. N et I D E  

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.NETIntegrated Development Environment (IDE):

o  Differences between VB.Net and VB6 IDEo  Creating Visual Basic .NET Projects

o  Setting Project Referenceso  VB.Net IDE Basic Featureso  Debugging Applications

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

Differences between VB.Net andVB6 IDE

Page 2 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page2of30

c There is one IDE for all .NET projects

c Solutions can contain multipleprogramming language

c The IDE is customizable through “MyProfile”

c The IDE has a built-in Internet browser

D i f f e r e n c es b e t w e e n

V B. Ne t a n d VB 6 I D E

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 environmentwhere you can develop all types of .NET applications, fromsimple 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 onesolution and edit all your code within the same IDE.

•  IDE is customizable through My Profile

The IDE is fully customizable through the My Profileconfiguration 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 applicationwindows.

[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 AllPrograms  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

8/8/2019 MELJUN CORTES Vb.net_handout_visual Studio Net Ide

http://slidepdf.com/reader/full/meljun-cortes-vbnethandoutvisual-studio-net-ide 3/17

  Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI

Page 3 of 17

The IDE Start WindowPage 3 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page3of30

c Start Window

T h e I D E  

S t ar t W i n d o w  

 

Figure 2.1 – The IDE Start Window

[The IDE Start Window , Page 3 of 30]

Choosing a Project TemplatePage 4 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page4of30

Cho o s i n g a

P r o j e c t Tem p l a t e  

c Visual Studio Templates

 Choosing a Project TemplatePage 5 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page5of30

Cho o s i n g a

P r o j e c t Tem p l a t e  

Windows services that will run

continuously regardless of whethera user is logged on or not

WindowsService

Console application that will runfrom a command line

ConsoleApplication

User-defined Web controls that

can be reused on Web page

Web Control

Library

User-defined Windows controlprojects

Windows

ControlLibrary

Class libraries that provide similar

functionality to Microsoft Active XDLL

Class Library

Standard Windows-basedapplications

WindowsApplications

Use this template to create:Template

 

Choosing a Project Template

To make a new project, from the Start Page  window, click File , and thenselect New Project. The New Project dialog box appears where thetemplates 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 applicationsare much more complex than console applications and can takeadvantage 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 Libraryto use in another application and for creating Class libraries thatprovide 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 creatingUser-defined Windows control projects.

Page 4: MELJUN CORTES Vb.net_handout_visual Studio Net Ide

8/8/2019 MELJUN CORTES Vb.net_handout_visual Studio Net Ide

http://slidepdf.com/reader/full/meljun-cortes-vbnethandoutvisual-studio-net-ide 4/17

  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 Windowsservices 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, thistemplate is installed.

[Choosing a Project Template, Pages 4-5 of 30]

 Analyzing Project StructuresPage 6 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page6of30

A n a l y z i n g

P r o j e c t St r u c t u r e s  

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. Tosimplify 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 moreprojects together, and are also used for storing certain globalinformation.

The .suo file extension is used for Solution User Options filesthat 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 timeyou 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 andcompilation options.

•  Local Project Items (.vb)Previous versions of Visual Basic use different file extensions todistinguish between classes (.cls), forms (.frm), modules (.bas)

and user controls (.ctl). Visual Basic .NET enables you to mixmultiple types within a single .vb fi le.

•  Web Project items (.aspx, .asmx, .asax)Web projects store their items in a Web server virtual directoryand 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, suchas .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

8/8/2019 MELJUN CORTES Vb.net_handout_visual Studio Net Ide

http://slidepdf.com/reader/full/meljun-cortes-vbnethandoutvisual-studio-net-ide 5/17

  Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI

Page 5 of 17

Creating VB .NET ProjectsPage 7 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page7of30

C r e a t i n g

VB .NET P r o j e c t s  

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 .NETapplications.

c Namespaces

q used in .NET Framework assemblies

q organize classes, interface and modulesinto 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 aVisual Studio .NET application. These files include .exe or .dll and

resources files such as graphics files. Assemblies are a key conceptin .NET development, they serve as a building block for all .NETapplication

Namespace

Namespaces are used in .NET Framework assemblies to organize the

objects of an assembly (classes, interfaces, and modules) into astructure that is easy to understand.

Namespaces group logically related objects together so that you caneasily 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 SQLServer database.

[Creating V B .NET Projects, Page 7 of 30]

Creating Windows ApplicationProject  Page 8 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page8of30

Cr e a t i n g W i n d o w s

A p p l i c a t i o n P r o j e c t  

c File > New Project

c 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 soluti on:

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

8/8/2019 MELJUN CORTES Vb.net_handout_visual Studio Net Ide

http://slidepdf.com/reader/full/meljun-cortes-vbnethandoutvisual-studio-net-ide 6/17

  Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI

Page 6 of 17

Setting Project ReferencesPage 9 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page9of30

S e t t i n g P r o j e c t

R e f e r e n c e s  

c Adding References

q select the current project in SolutionExplorer thenProject > Add Reference

q click .NET, COM, or Projects tab

q 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 thenOK 

 

Setting Project References

You can set project references to other applications or code libraries inorder 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 boxappears.

Figure 2.4 – Add Reference dialog box

2. In the Add Reference dialog box, select the appropriate type ofreference 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 thelist, 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 PropertiesPage 10 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page 10of30

S e t t i n g P r o j e c t

P r o p e r t i e s  

c Application Property Settings:

q Assembly name

q Root namespace

q Application type

q Startup object

q 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:

Application Properties

1. Assembly name. Give the name of the assembly when theapplication 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 anyfully quali fied 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

8/8/2019 MELJUN CORTES Vb.net_handout_visual Studio Net Ide

http://slidepdf.com/reader/full/meljun-cortes-vbnethandoutvisual-studio-net-ide 7/17

  Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI

Page 7 of 17

Setting Project PropertiesPage 11 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page 11of30

S e t t i n g P r o j e c t

P r o p e r t i e s  

c Compile Property Settings:

q Build output path

q Option explicit

q 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 Mainprocedure.

5. Assembly Information. Give the name of the Title, Description,

Company, Product, Copyright, Trademark, Assembly versionand 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 applicationwhen it is build or compiled.

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

3. Option Strict. If set to ON, i t provides strong typing and

prevents unintended type conversions with data loss anddisallows late binding .

Figure 2.6 – Compile Properties

[Setting Project Properties, Pages 10-11 of 30]

Page 8: MELJUN CORTES Vb.net_handout_visual Studio Net Ide

8/8/2019 MELJUN CORTES Vb.net_handout_visual Studio Net Ide

http://slidepdf.com/reader/full/meljun-cortes-vbnethandoutvisual-studio-net-ide 8/17

  Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI

Page 8 of 17

IDE FeaturesPage 12 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page 12of30

c Solution Explorer

c Object Browser

c Server Explorer

c TaskList

c Dynamic Help

I D E

F e a t u r e s  

 IDE FeaturesPage 13 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page 13of30

I D E

F e a t u r e s  

c Form Window

q where the controls that make up the user

interface are placed

IDE FeaturesPage 14 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page 14of30

I D E

F e a t u r e s  

c Code Window

q where the codes for forms, events and

methods are written, displayed andmodified

IDE Features

The VB .NET IDE contains several features that enable more efficientdevelopment of projects. These features which will be discussed later inthe topic include:

o  Solution Explorer

o  Object Browsero  Server Explorero  Task Listo  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

8/8/2019 MELJUN CORTES Vb.net_handout_visual Studio Net Ide

http://slidepdf.com/reader/full/meljun-cortes-vbnethandoutvisual-studio-net-ide 9/17

  Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI

Page 9 of 17

IDE FeaturesPage 15 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page 15of30

I D E

F e a t u r e s  

c Toolbox

q contains the objects and controls that can

be added to Windows Forms

IDE FeaturesPage 16 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page 16of30

I D E

F e a t u r e s  

c Component Tray

q where non-visual components that do notappear at run time are stored

 IDE FeaturesPage 17 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page 17of30

I D E

F e a t u r e s  

c Properties Window

q where properties of an object selected at

design time are modified

 

Toolbox

The Toolbox contains the objects and controls that can be added toWindows Forms applications. By default, the Toolbox displays the AllWindows Forms, Common Controls, Containers, Menus & Toolbars,

Data, Components, Printing, Dialogs, Crystal Reports (if installed) andGeneral. 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 t ime.

Figure 2.10 – Component Tray

Properties Window

Each object has its own unique set of properties. The Properties windowallows the user to modify the properties of any object that is currently

selected at design time. The default view for the Properties window is todisplay properties by Category. However, this can be changed to an

Page 10: MELJUN CORTES Vb.net_handout_visual Studio Net Ide

8/8/2019 MELJUN CORTES Vb.net_handout_visual Studio Net Ide

http://slidepdf.com/reader/full/meljun-cortes-vbnethandoutvisual-studio-net-ide 10/17

  Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI

Page 10 of 17

IDE FeaturesPage 18 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page 18of30

I D E

F e a t u r e s  

c Auto Hide

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

toolbar to toggle Auto Hide on and off 

c Tabbed Documents

q this mode adds a tab to the top of the

main window for each open document orfile

q click on the tab that represents the

document to switch between opendocuments

alphabetical view of properties by clicking the Alphabetical button

on the Propert ies window.

Figure 2.11 – Properties Window

Auto Hide

The new Auto Hide feature allows you to “hide” windows from the mainIDE where applications are developed. Every window that appears in theIDE 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 thetop of the main window for each document or file that opens .

To switch between open documents, simply click on the tab thatrepresents the document. To close a document or to navigate within theopen 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) applicationswhich 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

8/8/2019 MELJUN CORTES Vb.net_handout_visual Studio Net Ide

http://slidepdf.com/reader/full/meljun-cortes-vbnethandoutvisual-studio-net-ide 11/17

  Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI

Page 11 of 17

IDE FeaturesPage 19 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page 19of30

I D E

F e a t u r e s  

c Multiple Documents

q MDI – Multiple Document Interface

q display multiple documents simultaneously

q to work in an MDI environment

• Tools> Options

• c li ck Multiple documents on the Window

layoutsection

• c li ck OK 

c Dockablewindows

q all windows within the IDE can be dockedto 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 boxappears.

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. Simplydrag any window to whatever location and it will lock into place. The

combination of Auto Hide and Dockable windows allows completecustomization of IDE workspace.

[Using IDE Features, Pages 12-19 of 30]

Solution ExplorerPage 20 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page 20of30

c displays project hierarchy, project

references, project items and anysubfolders that contain project items

S o l u t i o n

E x p l o r e r  

 

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

8/8/2019 MELJUN CORTES Vb.net_handout_visual Studio Net Ide

http://slidepdf.com/reader/full/meljun-cortes-vbnethandoutvisual-studio-net-ide 12/17

  Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI

Page 12 of 17

Solution ExplorerPage 21 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page 21of30

c “Show all Files” mode

q click the Show all Files button to

display the hidden files or those marked asexcluded from the project

c Manipulating Projects

q Drag-and-drop editing

q Context menus

S o l u t i o n

E x p l o r e r  

 

“Show All Files” Mode

By default, Solution Explorer only shows some of the files stored in theproject hierarchy. Certain files, which do not form an integral part of thesolution, 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 withSolution Explorer:

•  Drag and Drop editingYou 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 excludingitems from the project, which remove the file from the project but

does not delete the file.

[Solution Explorer, Pages 20-21 of 30]

Server ExplorerPage 22 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page 22of30

S e r v e r

E x p l o r e r  

c Managing Data Connections

q 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 databasesby using the Data View window. Server Explorer provides the samefunctionality and additional functionality for managing and using server

components.

Managing Data Connections

To show the Server Explorer pane, click View  on the Menu bar thenclick 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 dialogbox.

Page 13: MELJUN CORTES Vb.net_handout_visual Studio Net Ide

8/8/2019 MELJUN CORTES Vb.net_handout_visual Studio Net Ide

http://slidepdf.com/reader/full/meljun-cortes-vbnethandoutvisual-studio-net-ide 13/17

  Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI

Page 13 of 17

Server ExplorerPage 23 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page 23of30

S e r v e r

E x p l o r e r  

c select Data Source from theData Sourcebox then click the Continuebutton

c click Browsebutton to select a databasefile and enter the corresponding Username and Password of the database

c click Test Connection to check if theconnection was successfully done

 

Upon selecting Data Source and clicking the Continue  button, AddConnection 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. Clickthe 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

8/8/2019 MELJUN CORTES Vb.net_handout_visual Studio Net Ide

http://slidepdf.com/reader/full/meljun-cortes-vbnethandoutvisual-studio-net-ide 14/17

  Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI

Page 14 of 17

Object BrowserPage 24 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page 24of30

c View> Object Browser

O b j e c t

B r o w s e r  

 Object BrowserPage 25 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page 25of30

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 classlibraries use inheritance in their object

hierarchies

Ob j e c t  

B r o w s e r  

 

Object Browser

To show the Object Browser pane, click View on the Menu bar then clickObject 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 showonly a high level view of objects and their methods. Using the VisualBasic .NET Object Browser you can:

1. Examine objects and their members within a library, exploringthe 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 useinheritance in their object hierarchies.

[Object Browser, Pages 24-25 of 30]

Task ListPage 26 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page 26of30

c tasks are kept in the .suo project file so

that information are not lost when theVisual Studio .NET is closed

c View > Other Windows > Task List

c Adding Task List

q type in the top row that is always visible to

the Task List window

q build your application to automatically addtasks to the list

q create comments in the code that use

specific token strings defined in the Optionsdialog box

Task L i s t  

W i n d o w  

Task List

Tasks are kept in the .suo project file so that you do not lose informationwhen you close your Visual Studio .NET session. The Task window aids

programmers in keeping track of tasks related to the project. To viewthe Task List window, from the View menu, select Other Windows  andthen choose Task List. You can also use the shortcut, <CTRL + ALT+

K>.

Figure 2.15 – Task List Window

Page 15: MELJUN CORTES Vb.net_handout_visual Studio Net Ide

8/8/2019 MELJUN CORTES Vb.net_handout_visual Studio Net Ide

http://slidepdf.com/reader/full/meljun-cortes-vbnethandoutvisual-studio-net-ide 15/17

  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 toprow that is always visible to the Task List window.

2. Visual Studio .NET automatically adds tasks to the list when youattempt 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 usespecific token strings defined in the Options dialog box, which is

accessible from the Tools menu.

[Using the Task List, Page 26 of 30]

Dynamic HelpPage 27 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page 27of30

c displays appropriate Help links to the .NETHelp files

c changes topic depending on the locationof the cursor

c Help > Dynamic Help

D y n am i c

H e l p  

CheckBoxselected

from theToolbox

Buttonselected

from theToolbox

 

Dynamic Help

The Dynamic Help window automatically displays appropriate Help linksto the .NET Help files, depending on where the cursor is and what text ishighlighted. MSDN must be installed in order to access this feature.

To show the dynamic help window, click Help menu then click DynamicHelp. The Dynamic Help pane appears on the right below the Solution

Explorer pane. Select a button control in the Toolbox pane and observethe 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 thecursor is.

[Using the Dynamic Help, Page 27 of 30]

Page 16: MELJUN CORTES Vb.net_handout_visual Studio Net Ide

8/8/2019 MELJUN CORTES Vb.net_handout_visual Studio Net Ide

http://slidepdf.com/reader/full/meljun-cortes-vbnethandoutvisual-studio-net-ide 16/17

  Visual Basic .NET Programming

The Visual Studio .NET IDE * Property of STI

Page 16 of 17

Designing VB .Net ApplicationPage 28 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page 28of30

De s i g n i n g VB .NET

A p p l i c a t i o n  

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 appearon 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, positionand size the necessary objects.

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

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

Notice that the steps are somewhat similar to that of designing aprogram in Visual Basic 6.

[Designing VB .NET Application, Page 28 of 30 ]

Debugging ApplicationsPage 29 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page 29of30

D e b u g g i n g

A p p l i c a t i o n s  

c Setting Breakpoints

q Ways

• click the margin to the left of the code window

on the line containingthe statement wheredebugger will halt

• Debug>NewBreakpoint

• place the cursor on the line where you wantthe debugger to halt. Press <F9>to switch the

breakpoint on and off.

c Debugging Code

q Step Into

q Step Over

q Step Out

 Debugging ApplicationsPage 30 of 30

The Visual Studio .NetIDE

VisualBasic.NETProgramming

* Property of STI 

Page 30of30

D e b u g g i n g

A p p l i c a t i o n s  

c Sample Demonstration:

q create a new project

q double-click the form to go to Code

window

q type following code on the Private SubForm1_Load event handler:

Dim X As Integer

Dim Y As Integer

X = 10

Y = X – 5MessageBox.Show(Y)

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

q press <F5>

q place the pointer on the Y variable

q press <F11> to Step into the code

q 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 setbreakpoints 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 linecontaining 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 tohalt. Press <F9> to switch the breakpoint on and off.

Debugging Code

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

the debugging buttons, Step Into   , Step Over   , Step Out   ,  in

the Standard toolbar. In Step Into, the application executes the currentstatement and enters the Break mode where the user can apply

changes. Step Over is the same as Step Into, except that when itreaches a call for another procedure, it wi ll 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 windowsapplication 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 eventhandler:

Page 17: MELJUN CORTES Vb.net_handout_visual Studio Net Ide

8/8/2019 MELJUN CORTES Vb.net_handout_visual Studio Net Ide

http://slidepdf.com/reader/full/meljun-cortes-vbnethandoutvisual-studio-net-ide 17/17

  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 indicatesthe breakpoint or the line of code where the execution will halt. 

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

7. Press <F11> to Step into the code and continue pressing until theprogram 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 whichconsists of a parent window and multiple other windows, suchas menus, toolbars, design and editing window, and other

windows associated with the parent window. 

•  In creating VB.NET projects, we encountered assemblies andnamespaces. 

•  Aside from adding references, we show how to set different

project properties, such as application, compile and debugproperties. 

•  We also show how to use the IDE features such as solution

explorer, object browser, server explorer, task list, and dynamichelp. 

•  The Visual Studio .NET IDE provides enhanced versions of

many of the debugging features found in previous versions ofVisual Basic.  

REFERENCES:

•  Microsoft Official Course, (2002), 2373B: Programming withMicrosoft Visual Basic .NET , Microsoft Corporation

•  Holzner, Steven, (2003), Sams teach yourself Microsoft VisualBasic.Net 2003 in 21 days, USA, Sams Publishing

•  Jesse Liberty, (2002), Learning Visual Basic .NET,   USA,O'Reilly & Associates, Inc.