Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Chapter 2 Introduction to Visual Basic Programming Visual Basic.NET.

Slides:



Advertisements
Similar presentations
Introduction to Visual Basic.NET Uploaded By: M.Sheraz anjum.
Advertisements

CS0004: Introduction to Programming Visual Studio 2010 and Controls.
Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
Visual Basic 2010 How to Program. © by Pearson Education, Inc. All Rights Reserved.2.
Visual Basic 2010 How to Program Reference: Instructor: Maysoon Bin Duwais slides Visual Basic 2010 how to program by Deitel © by Pearson Education,
IS 1181 IS 118 Introduction to Development Tools VB Chapter 06.
Chapter 1: An Introduction to Visual Basic.NET Programming with Microsoft Visual Basic.NET, Second Edition.
IS 118 Introduction to Development Tools
 2002 Prentice Hall. All rights reserved. Chapter 2 - Introduction to the Visual Studio.NET IDE Outline 2.1Introduction 2.2Overview of the Visual Studio.NET.
Using the Visual Basic Editor Visual Basic for Applications 1.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
Creating a Console Application with Visual Studio
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter One An Introduction to Visual Basic 2010.
2. Introduction to the Visual Studio.NET IDE 2. Introduction to the Visual Studio.NET IDE Ch2 – Deitel’s Book.
Slide 1 Chapter 2 Visual Basic Interface. Slide 2 Chapter 2 Windows GUI  A GUI is a graphical user interface.  The interface is what appears on the.
Visual Basic 2008 Express Edition The IDE. Visual Basic 2008 Express The Start Page Recent Projects Open an existing project Create a New Project.
Visual Basic Chapter 1 Mr. Wangler.
Hands-on Introduction to Visual Basic.NET Programming Right from the Start with Visual Basic.NET 1/e 6.
05/09/ Introducing Visual Basic Sequence Programming.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
Microsoft Visual Basic 2005: Reloaded Second Edition
IE 411/511: Visual Programming for Industrial Applications
© 2006 Lawrenceville Press Slide 1 Chapter 3 Visual Basic Interface.
Chapter 3 Introducing Visual Basic.NET. 3.1 Visual Basic.NET Windows Programming -Used to create Windows, Web, and Console applications -Uses predefined.
Tutorial 1: An Introduction to Visual Basic.NET1 Tutorial 1 An Introduction to Visual Basic.NET.
Chapter 1: An Introduction to Visual Basic 2005 Programming with Microsoft Visual Basic 2005, Third Edition.
1 1 Lab1 Ismail M. Romi – IT Dept, PPU, Visual Basic 2005 Programming Tour.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 4 I Need a Tour Guide.
Introduction to Visual Basic.NET Programming In Visual Basic.NET.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 2 The Visual Basic.NET Integrated Development Environment.
Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.
Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
 Application – another name for a program.  Interface – is what appears on the screen when the application is running.  Program Code – is instructions.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Program Design and Coding
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
Microsoft Visual Basic 2010 CHAPTER THREE Program Design and Coding.
OCC Network Drives  H:\  P:\ 
Chapter Two Creating a First Project in Visual Basic.
Visual Basic.NET BASICS Lesson 1 A First Look at Microsoft Visual Basic.NET.
Microsoft Visual Basic 2005 BASICS Lesson 1 A First Look at Microsoft Visual Basic.
CSC 230 (Blum)1 Visual Basic 2005 Hello World Fall 2005 T. Blum.
Hands-on Introduction to Visual Basic.NET Programming Right from the Start with Visual Basic.NET 1/e 6.
 2002 Prentice Hall. All rights reserved. 1 Chapter 2 – Introduction to the Visual Studio.NET IDE Outline 2.1Introduction 2.2Visual Studio.NET Integrated.
Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al- ajmi Chapter 3 Some Visual Basic Controls and Events Visual Basic. NET.
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter One An Introduction to Visual Basic 2008.
Chapter 1 Introduction to Visual Basic.NET Programming In Visual Basic.NET © 2001 by The McGraw-Hill Companies, Inc. All rights reserved.
Object-Oriented Application Development Using VB.NET 1 Chapter 2 The Visual Studio.NET Development Environment.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 3 Building an Application in the Visual Basic.NET Environment.
CSC 230 (Blum)1 Visual Basic 2005 Hello World Fall 2005 T. Blum.
Visual Basic.Net. Software to Install Visual Studio 2005 Professional Edition (Requires Windows XP Pro) MSDN Library for Visual Studio 2005 Available.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
Programming with Visual Basic.NET. Quick Links Program Code The Code Window The Event Procedure Assignment Statements Using AutoList Radio Buttons Buttons.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 6 Looping and Multiple Forms.
 2007 Pearson Education, Inc. All rights reserved Introduction to the Visual Basic Express 2005 IDE.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Chapter 1: An Introduction to Visual Basic .NET
Visual Basic.NET Windows Programming
Chapter 2: The Visual Studio .NET Development Environment
Chapter 1: An Introduction to Visual Basic 2015
Visual Basic Code & No.: CS 218
Chapter 2 Visual Basic Interface
Hands-on Introduction to Visual Basic .NET
CIS16 Application Development Programming with Visual Basic
Presentation transcript:

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Chapter 2 Introduction to Visual Basic Programming Visual Basic.NET

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Objectives Navigate the IDE Appreciate the use of a form Create controls on a form and adjust their sizes Understand the events, properties, and methods of controls Understand how the code and events work in a VB program

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Objectives Open and save a VB project Understand the coding mechanics and the naming convention Get help from the MSDN help system Enumerate( Number ) the types of statements in a program Run an executable without the IDE

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi The IDE Profile

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Starting the IDE The Visual Studio Start Page

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Starting a New Project Default: Windows Application

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi The Integrated Development Environment (IDE) Menu bar provides many menu items – Examples include File and Edit menus Toolbar lies below menu bar – Provides shortcuts to the menu bar Toolbox – Contains various icons representing VB controls Solution Explorer – Shows all forms, references, classes, and modules the current project contains

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi The IDE Menu bar Toolbar Blank form in IDE Toolbox

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Solution Explorer and Properties Window Solutions Explorer shows all the forms, references, classes, and modules in the project Properties window shows all the properties of the selected object

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Your First Visual Basic Program Form contains a label and a button Double-click the button on the form to open the code window

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi The Code Window Tabs at top let you toggle between the form and the code window Comments appear green in the IDE dot (period) Object-oriented syntax: object and property separated by dot (period) Procedure box lists events the object in the object box recognizes Object box lists all objects in the form

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi When You Run the Program Label changes when you click the Say Welcome button

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Understanding the IDE Design time – When you are placing controls on the form code window – When you are writing code in the code window Runtime – When the code in your project comes to life, responding to events Press Start on the Debug menu in the IDE Press the F5 key in the IDE Press the start button in the IDE

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Coding Mechanics Comments – Used to provide clues to the purpose of the code – Begin with tick mark (apostrophe) or Rem – Appear green in the IDE Showing Blocks of Code (Lists) – The IDE will help indent the code lines Line Continuation – If you have to write a long statement, break into lines by using the underscore ( _ ) character

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Interfaces of VB Objects objects Forms and controls are objects Objects have interfaces: – Properties: typically relate to appearance of objects – Events: user or system actions recognized by the object Procedures written to handle events – Methods: actions that objects are capable of performing

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Properties Special types of data associated with object Most relate to appearance of objects – i.e. Label1.BackColor = Color.Red (Try) Some relate to behavior of objects – i.e. Try the Properties Tab Object and property separated by dot (period) Property must be given a value

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Events User or system actions the object recognizes – i.e. a button has a Click event Event procedure – Procedure written to handle a specific event – Also called event handler Syntax: Private Sub ObjectName_Event – Code surrounded by Sub … End Sub – Private refers to the scope of the procedure – Object and event separated by underscore

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Methods Actions objects are capable of performing – i.e. Me.Close() Syntax: Object.Method(Parameter List) – Parameter list: arguments passed in to the method – Parameter list must be enclosed in parentheses, even if no parameters are required

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Getting Help from the Help Menu Enter search term in the Look for box Double-click an item in the list box Double-click an item in the lower center pane; upper center pane shows results

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Naming objects When naming objects, be descriptive – Use standard prefixes, i.e. lbl for label – Give the object a meaningful name i.e. a label with text “Name” could be lblName Change the object name in the Properties window before Name objects before placing code in the code window

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Assignment Statements Generate some sort of result – i.e. moving data from one location in memory to another Syntax: lblWelcome.Text = “Welcome” – Expression on right hand side of equation moved to memory location on left hand side Most common statements in VB programs

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Statements That Direct Execution Flow Conditional Execution – One block of code executed if a statement is true; a different block executed if false – If block is most common example Repetition – When you need to execute a block of code repetitively – For…Next loop is most common Code that “Jumps” – Exit Sub exits a procedure

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Completing the Development Cycle Program must be compiled into executable – When you test run your program, the IDE compiles and saves the executable To run the program: – Double-click the executable – Use the Run option off the Start menu – Add the executable to your Start menu

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Finding the Executable Executable is found in the /bin folder underneath the folder containing your project. In this case: C:\My Documents\ Visual Studio Projects\Welcome

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Summary Start the IDE from the Start Menu – Choose Visual Studio.NET from Programs menu Edit your profile to customize environment Menu bar gives you all menu items. Toolbar offers shortcuts to menu items Toolbox contains controls and components The form allows you to design visual elements – Code window behind form is where you place code Solution Explorer shows all files in your solution

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Summary Properties window shows properties of selected object To develop a program – Draw and adjust the controls on the form – Set properties of the objects – Place code in events, then test and revise The IDE allows you to write and compile the program Use comments in your code to show the purpose of the code Break long code lines with an underscore character

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Summary Objects have three types of interfaces: properties, methods, and events VS.Net help file provides a wealth of information Follow object naming conventions – Use predefined prefixes for objects – Give objects meaningful names Two types of programming statements: – Those that produce results – Those that control program flow

Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Summary Four types of objects introduced: – Form used for visual interface – Label used to display text to give clues – Button used to trigger actions – Timer used to keep track of time IDE automatically produces the executable when you develop the program Run the executable like other Windows programs