Starting Out with Visual Basic.NET 2 nd Edition Chapter 1 Introduction to Programming and Visual Basic.NET.

Slides:



Advertisements
Similar presentations
Introduction to Programming and Visual Basic 2005
Advertisements

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 1- 1 STARTING OUT WITH Visual Basic 2008 FOURTH EDITION Tony Gaddis.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter Introduction to Programming and Visual Basic
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Starting Out with C++, 3 rd Edition 1 Chapter 1. Introduction to Computers and Programming.
COSC 120 Computer Programming
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Sixth Edition by Tony Gaddis, Judy Walters,
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 1- 1.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
Chapter 1 Introduction to Programming and Visual Basic 2005 Lecture Notes Chapter 1 (CSIT 105)
Chapter Introduction to Programming and Visual Basic
Introduction to Programming and Visual Basic
Addison Wesley is an imprint of © 2011 Pearson Addison-Wesley. All rights reserved. Chapter 1 Introduction to Programming and Visual Basic.
CSCI Programming with Visual Basic Instructor: Bindra Shrestha University of Houston – Clear Lake.
Copyright 2003 Scott/Jones Publishing Brief Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Slide Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter Introduction to Programming and Visual Basic
CS102 Introduction to Computer Programming
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
Why Program? Computer – programmable machine designed to follow instructions Program – instructions in computer memory to make it do something Programmer.
Chapter Introduction to Computers and Programming 1.
Introduction to Programming Dr Masitah Ghazali Programming Techniques I SCJ1013.
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Visual Basic Chapter 1 Mr. Wangler.
Overview-An Overview of Visual Basic.NET1 An Overview of Visual Basic.NET.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming 1.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Chapter 1 Introduction to Computer and Java 1. Contents 1.Introduction 2.Why Program? 3.Computer Systems: Hardware and Software 4.Programming Languages.
Copyright © 2012 Pearson Education, Inc. Chapter 1 Introduction to Computing and Programming.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
CIS 115 Lecture 4.  Create a Windows-based application that will calculate the Gross Pay earned for a worker, given the number of hours worked and hourly.
Intro to Programming and Visual Basic .NET
Visual Basic Week 2
Visual C++ Programming: Concepts and Projects
Copyright © 2014 Pearson Education, Inc. Chapter 1 Introduction to Programming and Visual Basic.
COPYRIGHT 2007: Dr. David Scanlan, CSUS 010-HELLO WORLD VB-Express.ppt Purpose: A "Hello World" program's purpose is to eliminate as much complexity as.
Managing Controls Lab 2 2 All Rgihs ReservedIsmail M. Romi – PPu: IT DEpt.
Copyright © 2011 Pearson Addison-Wesley What is a Program Made Of? Keywords (Reserved Words) – Words with special meaning that make up a high-level programming.
Addison Wesley is an imprint of © 2011 Pearson Addison-Wesley. All rights reserved. Chapter 1 Introduction to Programming and Visual Basic.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Brief Version of Starting Out with C++ Chapter 1 Introduction to Computers and Programming.
Steps for Developing a Visual C# 2010 Application MIT By: S. Sabraz Nawaz.
Visual Basic.Net. Software to Install Visual Studio 2005 Professional Edition (Requires Windows XP Pro) MSDN Library for Visual Studio 2005 Available.
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved. Introduction to Computers and Computing.
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Eighth Edition by Tony Gaddis,
Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Visual Basic/ Visual Studio Brandon Large. Connecting to prior knowledge In your notes write down what the two main parts of the computer are. The “software”
Chapter 1 Introduction to Programming and Visual Basic.
Chapter 1: Introduction to Computers and Programming
BASIC PROGRAMMING C SCP1103 (02)
Introduction to Programming and Visual Basic .NET
Introduction to Programming and Visual Basic
BASIC PROGRAMMING C SCP1103 (02)
Introduction to Programming and Visual Basic 2008
An Introduction to Computers and Visual Basic
Chapter 1. Introduction to Computers and Programming
An Introduction to Computers and Visual Basic
Introduction to Programming and Visual Basic
Chapter 1: Introduction to Computers and Programming
Introduction to Programming and Visual Basic
CIS16 Application Development Programming with Visual Basic
STARTING OUT WITH Visual Basic 2008
An Introduction to Computers and Visual Basic
Chapter 1: Introduction to Computers and Programming
Presentation transcript:

Starting Out with Visual Basic.NET 2 nd Edition Chapter 1 Introduction to Programming and Visual Basic.NET

Starting Out with Visual Basic.NET 2 nd Edition 1.1 Introduction

Starting Out with Visual Basic.NET 2 nd Edition With Visual Basic.NET, You May Create applications with graphical windows, dialog boxes, menus, and so on Create applications that work with databases Create web applications and applications that use internet technologies Create applications that display graphics

Starting Out with Visual Basic.NET 2 nd Edition 1.2 Computer Systems: Hardware and Software All Computer Systems Consist of Similar Hardware Devices and Software Components

Starting Out with Visual Basic.NET 2 nd Edition Organization of a Computer System Central Processing Unit Main Memory Input Device Output Device Secondary Storage

Starting Out with Visual Basic.NET 2 nd Edition The CPU Fetches instructions Carries out the operations commanded by the instructions Produces some outcome or resultant information The instructions are part of a program stored as binary numbers

Starting Out with Visual Basic.NET 2 nd Edition Main Memory Commonly known as RAM (Random Access Memory) Consists of sequentially numbered storage locations In most contemporary computers, each location can store 8 bits, called a byte RAM is normally a volatile storage medium

Starting Out with Visual Basic.NET 2 nd Edition Secondary Storage A nonvolatile storage medium Will hold data without the computer being turned on Usually a disk drive (magnetic storage) Hard disks Floppy disks

Starting Out with Visual Basic.NET 2 nd Edition Input Devices A device that receives information from the outside world Keyboard Mouse Scanner

Starting Out with Visual Basic.NET 2 nd Edition Output Devices Sends information from the computer to the outside world Display Printer

Starting Out with Visual Basic.NET 2 nd Edition Software Programs that run the computer Operating System Software: a set of programs that manages the computer's hardware devices (e.g. Windows 2000) Application Software: a program that makes the computer useful to the user (e.g. Word, computer games, Internet browsers)

Starting Out with Visual Basic.NET 2 nd Edition 1.3 Programs and Programming Languages A Program Is a Set of Instructions a Computer Follows in Order to Perform a Task A Programming Language Is a Special Language Used to Write Computer Programs

Starting Out with Visual Basic.NET 2 nd Edition What Is a Program?, I 1.Display a message on the screen: "How many hours did you work?" 2.Allow the user to enter the number of hours worked 3.Once the user enters a number, store it in memory 4.Display a message on the screen: "How much do you get paid per hour?" 5.Allow the user to enter an hourly pay rate

Starting Out with Visual Basic.NET 2 nd Edition What Is a Program?, II 6.Once the user enters a number, store it in memory 7.Once both the number of hours worked and the hourly pay rate are entered, multiply the two numbers and store the result in memory 8.Display a message on the screen that shows the amount of money earned. The message must include the result of the calculation performed in step 7

Starting Out with Visual Basic.NET 2 nd Edition Common Programming Languages BASIC FORTRAN COBOL Pascal C C++ Java

Starting Out with Visual Basic.NET 2 nd Edition Methods of Programming Procedural Constructed as a set of procedures (operational, functional units) Object-Oriented Constructed as a set of objects Objects have data elements and perform actions

Starting Out with Visual Basic.NET 2 nd Edition Example of an Object This is a GUI object Data includes number-of- hours-worked, hourly-pay- rate, and gross-pay-earned Action is to calculate and display gross-pay- earned, given number-of-hours-worked and hourly-pay-rate

Starting Out with Visual Basic.NET 2 nd Edition Event Driven Programming: Events An event is an action that takes place within a program, such as the clicking of a control All Visual Basic.NET controls are capable of detecting various events

Starting Out with Visual Basic.NET 2 nd Edition Event Driven Programming: Procedures For every event, there must be an event procedure You will write Visual Basic.NET code that will instruct the computer what actions to take whenever a specific event is triggered

Starting Out with Visual Basic.NET 2 nd Edition 1.4 More About Controls and Programming As a Visual Basic.NET Programmer, You Must Design and Create the Two Major Components of an Application: the GUI Elements (Forms and Other Controls) and the Programming Statements That Respond to And/or Perform Actions (Event Procedures)

Starting Out with Visual Basic.NET 2 nd Edition Visual Basic.NET Controls As a Windows Operating System user, you are already familiar with many of these controls: Label - A box that displays text RadioButton - A round button that can be selected or not with the mouse Form - A window with other controls within it

Starting Out with Visual Basic.NET 2 nd Edition Other Visual Basic.NET Controls CheckBox ComboBox Button GroupBox HScrollBar ListBox TextBox VScrollBar

Starting Out with Visual Basic.NET 2 nd Edition Name Property All of the controls have Properties Each Property has a value (or values) Every control has a Name Property The value of the Name Property is what it is called in programs The value of the name property of one of the authors of this book is: Tony

Starting Out with Visual Basic.NET 2 nd Edition Examples of Names, I btnCalcGrossPay btnClose txtHoursWorked txtPayRate lblGrossPay Label1 Label2 Label3

Starting Out with Visual Basic.NET 2 nd Edition Examples of Names, II Names like Label1 are default names generated by Visual Basic.NET Others are programmer specified using a naming convention: txt… for Text Boxes lbl… for Labels btn… for Buttons

Starting Out with Visual Basic.NET 2 nd Edition Gross Pay Calculation Code Private Sub btnCalcGrossPay_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnCalcGrossPay.Click Dim grossPay As Single ‘ The next line calculates the gross pay. grossPpay = Val(txtHoursWorked.Text) * Val(txtPayRate.Text) lblGrossPay.Text = FormatCurrency(grossPay) End Sub

Starting Out with Visual Basic.NET 2 nd Edition Close Code Private Sub btnClose_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnClose.Click ‘ End the application. End End Sub

Starting Out with Visual Basic.NET 2 nd Edition Language Elements Keywords: Words with special meaning to Visual Basic.NET (e.g., Private, Sub ) Programmer-defined-names: Names created by the programmer (e.g., grossPay ) Operators: Special symbols to perform common operations (e.g.: +, -, *, and /) Remarks: Comments inserted by the programmer - not part of the running program

Starting Out with Visual Basic.NET 2 nd Edition Language Elements: Syntax Syntax means how things are formed The syntax of Visual Basic.NET specified how the Language Elements can be combined to form a valid program The syntax of the English Language defines how sentences are formed from the parts of speech (nouns, verbs, etc.)

Starting Out with Visual Basic.NET 2 nd Edition 1.5 The Programming Process The Programming Process Consists of Several Steps, Which Include Design, Creation, Testing, and Debugging Activities

Starting Out with Visual Basic.NET 2 nd Edition Step 1 of Developing an Application Clearly define what the program is to do For example: Purpose: To calculate the user’s gross pay Input: Number of hours worked, hourly pay rate Process: Multiply number of hours worked by hourly pay rate (The result is the user’s gross pay) Output: Display a message indicating the user’s gross pay

Starting Out with Visual Basic.NET 2 nd Edition Step 2 of Developing an Application Visualize the application running on the computer and design its user interface

Starting Out with Visual Basic.NET 2 nd Edition Step 3 of Developing an Application Make a list of the controls needed Partial list: TypeNameDescription TextBoxtxtHoursWorkedAllows the user to enter the number of hours worked. TextBoxtxtPayRateAllows the user to enter the hourly pay rate LabellblGrossPayDisplays the gross pay, after the btnCalcGrossPay button has been clicked ButtonbtnCalcGrossPayWhen clicked, multiplies the number of hours worked by the hourly pay rate ButtonbtnCloseWhen clicked, terminates the application

Starting Out with Visual Basic.NET 2 nd Edition Step 4 of Developing an Application Define the Values of Each Control's Relevant Properties: Control TypeControl NameText Form(Default)"Wage Calculator" Label(Default)"Number of Hours Worked" Label(Default)"Hourly Pay Rate" Label(Default)"Gross Pay Earned" LabellblGrossPay"$0.00" TextBoxtxtHoursWorked"" TextBoxtxtPayRate"" ButtonbtnCalcGrossPay"Calculate Gross Pay" ButtonbtnClose"Close"

Starting Out with Visual Basic.NET 2 nd Edition Step 5 of Developing an Application Make a list of methods needed for each control: MethodDescription btnCalcGrossPay_ClickMultiplies the number of hours worked by the hourly pay rate These values are entered into the txtHoursWorked and txt-PayRate TextBoxes The result is stored in the lblGrossPay Text property btnClose_ClickTerminates the application

Starting Out with Visual Basic.NET 2 nd Edition Step 6 of Developing an Application Create a pseudocode version of each method: Pseudocode is a combination of English and a programming language For this application: Store Number of Hours Worked times Hourly Pay Rate in grossPay. Store the value in grossPay in lblGrossPay.Text.

Starting Out with Visual Basic.NET 2 nd Edition Step 7 of Developing an Application Check the code for errors: Go step by step through the code, running it in your head as though the computer is running it Keep track of where in the code is being executed Keep track of the values of all of the variables

Starting Out with Visual Basic.NET 2 nd Edition Step 8 of Developing an Application Use Visual Basic.NET to create the forms and other controls identified in step 3 This is the first use of Visual Basic.NET, all of the previous steps have just been on paper

Starting Out with Visual Basic.NET 2 nd Edition Step 9 of Developing an Application Use Visual Basic.NET to write the code for the event procedures and other methods created in step 6 This is the second step on the computer

Starting Out with Visual Basic.NET 2 nd Edition Step 10 of Developing an Application Attempt to run the application - find syntax errors Correct any syntax errors found and repeat this step as often as necessary All of the syntax errors must be removed before Visual Basic.NET will create a program that you can actually run on the computer

Starting Out with Visual Basic.NET 2 nd Edition Step 11 of Developing an Application Run the application - once all syntax errors are fixed Run the program with a variety of test data Check the results to be sure that they are correct Correct any errors found Repeat steps 10 and 11 as many times as necessary

Starting Out with Visual Basic.NET 2 nd Edition 1.6 Visual Studio and the Visual Basic.NET Environment Visual Studio Consists of Tools That You Use to Build Visual Basic.NET Applications

Starting Out with Visual Basic.NET 2 nd Edition The Visual Basic.NET Environment, I Design Window Solution Explorer Window Dynamic Help Window Properties Window Docked and Floating Windows Title Bar

Starting Out with Visual Basic.NET 2 nd Edition The Visual Basic.NET Environment, II Menu Bar Standard Toolbar Layout Toolbar Toolbox Using Tooltips