MELJUN CORTES Vb.net_the Vb .Net IDE

download MELJUN CORTES Vb.net_the Vb .Net IDE

of 14

Transcript of MELJUN CORTES Vb.net_the Vb .Net IDE

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    1/30

    Visual Basic .NET Programming

    The Visual Studio

    .Net IDE 

    Differences between VB.Net and VB6 IDE

    Creating Visual Basic .NET Projects

    Setting Project References

    The Visual Studio .Net IDE * Property of STI Page 1 of 30

    Using Development Environment Features

    Debugging Applications

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    2/30

    Visual Basic .NET Programming

    There is one IDE for all .NET projects

    Solutions can contain multiple

    programming language

    The IDE is customizable through “My

    Differences between

    VB.Net and VB6 IDE

    The Visual Studio .Net IDE * Property of STI Page 2 of 30

    ro e

    The IDE has a built-in Internet browser

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    3/30

    Visual Basic .NET Programming

    Start Window

    The IDE 

    Start Window 

    The Visual Studio .Net IDE * Property of STI Page 3 of 30

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    4/30

    Visual Basic .NET Programming

    Choosing a

    Project Template

    Visual Studio Templates

    The Visual Studio .Net IDE * Property of STI Page 4 of 30

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    5/30

    Visual Basic .NET Programming

    Choosing a

    Project Template

    Template Use this template to create:

    WindowsApplications

    Standard Windows-basedapplications

    Class Library

    Class libraries that provide similar

    functionality to Microsoft Active X

    The Visual Studio .Net IDE * Property of STI Page 5 of 30

    Windows

    ControlLibrary

    User-defined Windows control

    projects

    Web Control

    Library

    User-defined Web controls that

    can be reused on Web page

    Console

    Application

    Console application that will run

    from a command line

    Windows

    Service

    Windows services that will runcontinuously regardless of whether

    a user is logged on or not

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    6/30

    Visual Basic .NET Programming

     Analyzing

    Project Structures

    What follows are the files contained in

    every VB .Net project:

    Solution files (.sln,。suo)

    Project files (.vbproj)

    The Visual Studio .Net IDE * Property of STI Page 6 of 30

    Local project items (.vb)

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

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    7/30

    Visual Basic .NET Programming

    Creating

    VB .NET Projects

    Assemblies

    one or more files that make up a Visual

    Studio Application

    key concept in .NET development

    The Visual Studio .Net IDE * Property of STI Page 7 of 30

    serve as building block for all .NET

    applications.

    Namespaces

    used in .NET Framework assemblies

    organize classes, interface and modulesinto a structure that is easy to understand

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    8/30

    Visual Basic .NET Programming

    Creating Windows

     Application Project 

    File > New Project

    select the Windows Application template

    type a name for the project then click OK 

    The Visual Studio .Net IDE * Property of STI Page 8 of 30

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    9/30

    Visual Basic .NET Programming

    Setting Project

    References Adding References

    select the current project in Solution

    Explorer then Project > Add Reference

    The Visual Studio .Net IDE * Property of STI Page 9 of 30

    click .NET, COM, or Projects tab

    locate the required component in the list

    • you may click the Browse tab to locate thefile

    repeat step 3 for all the components you

    require, and then OK 

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    10/30

    Visual Basic .NET Programming

    Setting Project

    Properties

    Application Property Settings:

    Assembly name

    Root namespace

    Application type

    Startup object

    Assembly Information

    The Visual Studio .Net IDE * Property of STI Page 10 of 30

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    11/30

    Visual Basic .NET Programming

    Setting Project

    Properties

    Compile Property Settings:

    Build output path

    Option explicit

    Option Strict

    The Visual Studio .Net IDE * Property of STI Page 11 of 30

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    12/30

    Visual Basic .NET Programming

    Solution Explorer

    Object Browser

    Server Explorer

     IDE

    Features

    The Visual Studio .Net IDE * Property of STI Page 12 of 30

    Task List

    Dynamic Help

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    13/30

    Visual Basic .NET Programming

     IDE

    Features

    Form Window

    where the controls that make up the user

    interface are placed

    The Visual Studio .Net IDE * Property of STI Page 13 of 30

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    14/30

    Visual Basic .NET Programming

     IDE

    Features

    Code Window

    where the codes for forms, events and

    methods are written, displayed and

    modified

    The Visual Studio .Net IDE * Property of STI Page 14 of 30

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    15/30

    Visual Basic .NET Programming

     IDE

    Features

    Toolbox

    contains the objects and controls that can

    be added to Windows Forms

    The Visual Studio .Net IDE * Property of STI Page 15 of 30

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    16/30

    Visual Basic .NET Programming

     IDE

    Features

    Component Tray

    where non-visual components that do not

    appear at run time are stored

    The Visual Studio .Net IDE * Property of STI Page 16 of 30

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    17/30

    Visual Basic .NET Programming

     IDE

    Features

    Properties Window

    where properties of an object selected at

    design time are modified

    The Visual Studio .Net IDE * Property of STI Page 17 of 30

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    18/30

    Visual Basic .NET Programming

     IDE

    Features

    Auto Hide

    “hides” windows from the main IDE

    click the Auto Hide button on the

    toolbar to toggle Auto Hide on and off 

    The Visual Studio .Net IDE * Property of STI Page 18 of 30

    Tabbed Documents

    this mode adds a tab to the top of the

    main window for each open document orfile

    click on the tab that represents the

    document to switch between open

    documents

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    19/30

    Visual Basic .NET Programming

     IDE

    Features Multiple Documents

    MDI – Multiple Document Interface

    display multiple documents simultaneously

    to work in an MDI environment

    • Tools > Options

    The Visual Studio .Net IDE * Property of STI Page 19 of 30

    • click Multiple documents on the Window

    layout section

    • click OK 

    Dockable windows

    all windows within the IDE can be dockedto any edge of the IDE by dragging them to

    any location

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    20/30

    Visual Basic .NET Programming

    displays project hierarchy, project

    references, project items and any

    subfolders that contain project items

    Solution

    Explorer 

    The Visual Studio .Net IDE * Property of STI Page 20 of 30

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    21/30

    Visual Basic .NET Programming

    “Show all Files” mode

    click the Show all Files button to

    display the hidden files or those marked asexcluded from the project

    Mani ulatin Pro ects

    Solution

    Explorer 

    The Visual Studio .Net IDE * Property of STI Page 21 of 30

     

    Drag-and-drop editing

    Context menus

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    22/30

    Visual Basic .NET Programming

    Server

    Explorer 

    Managing Data Connections

    View > Server Explorer

    The Visual Studio .Net IDE * Property of STI Page 22 of 30

    Adding a connection

    click Connect to Database on the

    Server Explorer toolbar

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    23/30

    Visual Basic .NET Programming

    Server

    Explorer 

    select Data Source from the Data Source

    box then click the Continue button

    The Visual Studio .Net IDE * Property of STI Page 23 of 30

    click Browse button to select a database

    file and enter the corresponding User

    name and Password of the database

    click Test Connection to check if the

    connection was successfully done

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    24/30

    Visual Basic .NET Programming

    View > Object Browser

    Object

    Browser 

    The Visual Studio .Net IDE * Property of STI Page 24 of 30

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    25/30

    Visual Basic .NET Programming

    Using the VB .NET Object Browser, you

    can:

    examine objects and their members within

    a library

    access lower-level items

    Object 

    Browser 

    The Visual Studio .Net IDE * Property of STI Page 25 of 30

    examine how the .NET Framework class

    libraries use inheritance in their object

    hierarchies

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    26/30

    Visual Basic .NET Programming

    tasks are kept in the .suo project file so

    that information are not lost when the

    Visual Studio .NET is closed

    View > Other Windows > Task List

    Task List 

    Window 

    The Visual Studio .Net IDE * Property of STI Page 26 of 30

    Adding Task List

    type in the top row that is always visible to

    the Task List window

    build your application to automatically add

    tasks to the list

    create comments in the code that usespecific token strings defined in the Options

    dialog box

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    27/30

    Visual Basic .NET Programming

    displays appropriate Help links to the .NET

    Help files

    changes topic depending on the location

    of the cursor

    Help > Dynamic Help

    Dynamic

    Help

    The Visual Studio .Net IDE * Property of STI Page 27 of 30

    CheckBox

    selected

    from the

    Toolbox

    Buttonselected

    from the

    Toolbox

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    28/30

    Visual Basic .NET Programming

    Designing VB .NET

     Application

    Steps in creating a program in VB .Net.

    Create the interface

    Set properties

     

    The Visual Studio .Net IDE * Property of STI Page 28 of 30

     

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    29/30

    Visual Basic .NET Programming

    Debugging

     Applications

    Setting Breakpoints

    Ways

    • click the margin to the left of the code window

    on the line containing the statement wheredebugger will halt

    • Debug  Debug Debug Debug > New BreakpointNew BreakpointNew BreakpointNew Breakpoint

    • place the cursor on the line where you want

    the debugger to halt. Press to switch the

    The Visual Studio .Net IDE * Property of STI Page 29 of 30

     

    breakpoint on and off.

    Debugging Code Step Into

    Step Over

    Step Out

  • 8/8/2019 MELJUN CORTES Vb.net_the Vb .Net IDE

    30/30

    Visual Basic .NET Programming

    Debugging

     Applications Sample Demonstration:

    create a new project

    double-click the form to go to Code

    window

    type following code on the Private SubForm1_Load event handler:

    Dim X As Integer

    Dim Y As Integer

    X = 10

    Y = X – 5

    MessageBox.Show(Y)

    place the pointer on the line Y = X – 5

    then press

    press

    place the pointer on the Y variable

    press to Step into the code

    close the program