Presentation is loading. Please wait.

Presentation is loading. Please wait.

Getting Started with VB .NET

Similar presentations


Presentation on theme: "Getting Started with VB .NET"— Presentation transcript:

1 Getting Started with VB .NET
Chapter 1 Getting Started with VB .NET

2 Objectives Learn about VB .NET and the characteristics of a VB .NET solution Start and configure VB .NET Explore the elements of the development environment Learn how to access Help Open a VB .NET solution Explore the tool windows and operating modes of VB .NET

3 Introducing Visual Studio .NET
Visual Studio .NET is an integrated development environment Development environment supports three different languages Visual Basic Visual C++ C# (pronounced C sharp) New to Visual Studio .NET Note that Visual Interdev is obsolete. Functionality included with other Visual Studio .NET products

4 Introducing Visual Studio.NET
Applications (called solutions) developed using a developer interface called the Microsoft Development Environment (MDE) VB .NET supports different types of applications created with the following tools Windows Forms used to create desktop applications Web Forms used to create programmable Web pages Web Services process client – server requests

5 ? Programming Languages
Programming language are made up of words forming statements A Statement expresses a complete thought or idea Similar to an English sentence Statements grouped into procedures A procedure is similar to a paragraph in English Procedures grouped into a module Modules contain one or more procedures Modules correspond to physical disk files Module files have the suffix .vb.

6 ? Programming Languages
A program contains statements, grouped into procedures, in one or more modules VB .NET calls a program a solution Each solution is stored in its own folder Solution folder contains sub folder Solution folder contains all of the files that make up the solution

7 Program Relationships
Public Class frmMain Inherits System.Windows.Forms.Form Private components = New System.ComponentModel.Container End Class Module file frmMain.vb Public Sub New() End Sub Procedure MyBase.New() InitializeComponent() Executable statements Public Sub InitializeComponent() End Sub Procedure Me.Text = "Chapter 1 – Completed Example Executable statement Public Class frmDialog End Class Module file frmDialog.vb

8 Types of Statements Declaration statements define the names of data and procedures The following statements declare a variable and a procedure Private mstrCustomerName As String Private Sub InitializeComponent() End Sub Executable statements perform a specific action The following statement closes the form named frmMain frmMain.Close()

9 Syntax Programming statements adhere to rules known as syntax
Statements must be exactly correct VB .NET cannot interpret statements with typographical or spelling errors Incorrect statements will cause a syntax error Syntax errors occur when a statement violates the rules of the language Private mstrCustomerName As Strung frmMain.Closed()

10 VB .NET Programming Concepts
VB .NET solutions have the same characteristics as other programs Window is a rectangular area on the desktop Win Form (form) contains buttons and textboxes Buttons, textboxes, and the form itself are all objects Solutions contain 1 or more forms Collection of forms, buttons, and textboxes form the user interface User interface represents what the user sees and how the user interacts with the solution

11 Object Oriented Terms Information hiding – Expose only essential information and hide inner logic Encapsulation – Integrate (package) data and processes that act on data together Inner logic is hidden from the developer Inheritance – Create new objects from existing objects Inherit one form from another form Polymorphism – Multiple procedures of the same name perform different tasks Capable of taking many forms

12 Object Oriented Terms Programming object mimics the behavior of a real-world object Buttons on a form perform a task when clicked Some objects are visible to the user – others are not Objects are created from classes Multiple objects can be created from the same class. For example, create multiple buttons on a form A class is a blueprint (template) for an object Buttons on a form created from the Button class TextBoxes created from the TextBox class

13 Internal View of a VB .NET Solution
An object has: Predefined behaviors or settings called properties Properties exist to define the size and position of a button on a form, for example They are like adjectives they describe the object Methods represent the actions an object can perform They are like verbs they perform an action Events allow messages to be sent to a solution Write code in event handlers also known as event procedures When the user clicks a button, statement in the corresponding event handler execute

14 Internal View of a VB .NET Solution
We use controls to create objects on a form A control created on a form is called a control instance Button control is a button the user can click Label control displays text but cannot receive input OpenFileDialog control displays a standard dialog box allowing user to select a file PictureBox control displays pictures All control instances are created from their respective class

15 Sample of VB .NET Controls
Label control instance to display file name Label control instance to display a descriptive prompt PictureBox control instance to display graphical image Buttons when clicked perform an action OpenFileDialog control instance has no visual interface and appears in a tray at the bottom of the form

16 Starting VB .NET Microsoft Visual Studio.NET 7.0 Start button

17 Configuring VB .NET VB .NET supports two operating modes
Tabbed documents environment Docked windows appear along edge of the MDE (?) Docked windows can be temporarily hidden Floating windows appear anywhere on the desktop Windows can be autohidden along any edge of the MDE Multiple document interface Appearance similar to Excel

18 Configuring VB .NET On the Menu bar, click Tools, and then click Options to display Options dialog box General tab sets environment (tabbed documents or MDI mode) Projects and Solutions tab sets default folder for projects and when changes are saved

19 VB .NET Options Dialog Box – General Tab
Select folder Active page highlighted

20 VB .NET Options Dialog Box – Projects and Solutions Tab
Default project location

21 VB .NET Window Types Document window Docked window Autohidden window
Floating window

22 Configuring the Menu Bar and Toolbar
Multiple regions display toolbars Regions appear along any edge of the MDE Individual toolbars can be hidden or made visible depending on task at hand Use Customize dialog to configure toolbars Floating toolbars appear anywhere on the desktop Docked toolbars anchored along any edge of the MDE Usually they appear below the menu bar

23 Docked and Floating Toolbars
Docked toolbar Floating toolbar Toolbars docked along bottom of MDE

24 Document Windows Appear on group tabs and correspond to the individual files that make up a solution Win Form Designer used to create the user interface Code Editor used to write statements in event handlers Only one document window visible at a time Select window on group tab to activate desired document window Buttons to the right of a group tab navigate between document windows and close them

25 Tool Windows The same tool windows are used in the creation of all VB .NET solutions Solution Explorer groups all elements needed to build and run a solution Properties window allows developer to manage the appearance of each object Help windows are also tool windows Tool windows can be: Docked – appearing along an edge of the MDE Autohidden – hidden along an edge of the MDE Floating – appearing anywhere on the desktop

26 Document Windows & Tool Windows
Document windows appear on tab group Close active document window Solution Explorer is a tool window (appearing as a docked window

27 Configuring Tool Windows
Make a window float by right-clicking on the title bar and select Floating Autohide a window by first docking the window. Right-click the title bar and select Autohide Dock a window by right-clicking the title bar and select dockable. Drag the window to an edge of the MDE Configure windows as desired so that they best fit your needs

28 Configuring Tool Windows
Docked window Autohidden windows appear along an edge of the MDE

29 Getting Help VB .NET supports four primary help windows
Index – alphabetical list of contents Contents – table of contents organized by topic Search – locate topics by keyword Dynamic Help – new to .NET Display topics based on active window and current task Topics that appear in the Dynamic Help window will change as you navigate from window to window Help filters restrict information displayed

30 Help – Index Index tab Filter applied Applicable topics

31 Help – Contents Book expanded Topic

32 Help – Search Search text Search results

33 Help – Dynamic Help Dynamic Help Window

34 Opening a VB .NET Solution
Click File, and then click Open Solution Select folder Enter solution name Click to Open solution

35 Organization of a VB .NET Solution
Solution file is at the heart of the application Controls how solution will be translated into executable file Controls how application will be distributed File suffix is .sln Solution file references one or more project files which: Store global information List the other files in the project List references to namespaces

36 Form Modules Projects can contain multiple forms
Each form stored in a form module Form module contains code to create control instances Also contains code written by the developer to perform tasks File suffix is .vb Do not change file suffix or VB .NET will not be able to locate files

37 Elements of a Solution solution file form module frmDialog.vb
form module frmMain.vb class module clsDemo.vb project file Complete01.vbproj standard module stdDemo.vb Bin folder contains compiled solution Obj folder contains temporary files text file solution items icon files miscellaneous files

38 The Solution Explorer Groups projects and modules comprising a solution

39 Properties Window Property is a characteristic of an object
Color, caption, screen location Set properties using the Properties window Name column lists property Value column contains current value Display properties alphabetically or by category Description of selected appears at the bottom of the window Description section may be hidden

40 Selected Font property has subproperties
Properties Window (2) Object list box Toolbar area Selected Font property has subproperties Description area

41 Visual controls appear in the Toolbox

42 Operating Modes Three operating modes
In run mode VB .NET is executing the program Program appears as the user will see it In design mode you assume the role of the developer In break mode solution is temporarily suspended Use for debugging Refer to Appendix A for information on debugging

43 Running a Solution Press Start button on the Debug toolbar
Solution runs as the user will see it Press Stop Debugging button on the Debug toolbar to end the solution and return to design mode


Download ppt "Getting Started with VB .NET"

Similar presentations


Ads by Google