1-1 Chapter 1 Introduction to Visual Basic 2010 Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.

Slides:



Advertisements
Similar presentations
1-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Advertisements

Introduction to Visual Basic.NET Uploaded By: M.Sheraz anjum.
CS0004: Introduction to Programming Visual Studio 2010 and Controls.
© by Pearson Education, Inc. All Rights Reserved.
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,
Visual Basic Project Files:.VBP file: Project File: a small text file that contains the names of other files in the project, as well as some information.
Introduction to Visual Basic Programming. Lecture Outline History What is Visual Basic First Look at the VB 6.0 Environment Some VB Terminology Our first.
 2006 Pearson Education, Inc. All rights reserved Introduction to the Visual C# 2005 Express Edition IDE.
Chapter 1 Introduction to Visual Basic.NET Programming In Visual Basic.NET © 2001 by The McGraw-Hill Companies, Inc. All rights reserved.
Chapter 1 Introduction to Visual Basic 2010 Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Copyright © 2012 Pearson Education, Inc. Chapter 2 Introduction to Visual C#
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
 Visual Basic is an object-oriented language used to write application programs that run in Windows or on the Internet using a graphical user interface.
Creating a Console Application with Visual Studio
Chapter 1 Introduction to Programming and C# Programming in C#.NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
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.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
Lecture 2 Introduction to Visual Basic.NET Programming Appreciation.
A First Program Using C#
Visual Basic Chapter 1 Mr. Wangler.
05/09/ Introducing Visual Basic Sequence Programming.
Microsoft Visual Basic 2005: Reloaded Second Edition
Chapter 1 P. 1 Writing Windows applications with Visual Basic Figure 1.1 The first program works as follows: (These operations can be performed in any.
An Introduction to Visual Basic
IE 411/511: Visual Programming for Industrial Applications
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 2 Welcome Application Introducing the Visual Basic 2008 Express Edition IDE.
Introduction to Visual Basic.NET Programming In Visual Basic.NET.
Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Chapter Two Creating a First Project in Visual Basic.
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Introduction to Visual Basic.NET 2008 Chapter 1.
Visual Basic.NET BASICS Lesson 1 A First Look at Microsoft Visual Basic.NET.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 8 Debugging, Creating Executable Files, and Distributing a Windows Application.
Chapter 2 – Introduction to the Visual Studio .NET IDE
Microsoft Visual Basic 2005 BASICS Lesson 1 A First Look at Microsoft Visual Basic.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
 2002 Prentice Hall. All rights reserved. 1 Chapter 2 – Introduction to the Visual Studio.NET IDE Outline 2.1Introduction 2.2Visual Studio.NET Integrated.
1 Introduction to Visual Basic Dr Mohd Nabil Almunawar MS 3403 Advanced Computing.
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter One An Introduction to Visual Basic 2008.
Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Chapter 2 Introduction to Visual Basic Programming Visual Basic.NET.
Chapter 1 Introduction to Visual Basic.NET Programming In Visual Basic.NET © 2001 by The McGraw-Hill Companies, Inc. All rights reserved.
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Introduction to Visual Basic 2008 Chapter 1.
Object-Oriented Application Development Using VB.NET 1 Chapter 2 The Visual Studio.NET Development Environment.
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 C# 2010 Fourth Edition Chapter 3 Using GUI Objects and the Visual Studio IDE.
Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Introduction to Programming and Visual C# 2008
Dive Into® Visual Basic 2010 Express
DDC 3363 Programming III Main Reference
Visual Basic.NET Windows Programming
Chapter 2: The Visual Studio .NET Development Environment
DDC 3363 – Programming III Main Reference
Chapter 1: An Introduction to Visual Basic 2015
Chapter 2 – Introduction to the Visual Studio .NET IDE
1. Introduction to Visual Basic
Using Procedures and Exception Handling
Chapter 2 – Introduction to the Visual Studio .NET IDE
Hands-on Introduction to Visual Basic .NET
Understanding the Visual IDE
CIS16 Application Development Programming with Visual Basic
Visual Studio.
Presentation transcript:

1-1 Chapter 1 Introduction to Visual Basic 2010 Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill

1-2 Chapter Objectives (1 of 2) Describe the process of visual program design and development. Explain the term object-oriented programming. Explain the concepts of classes, objects, properties, methods, and events. List and describe the three steps for writing a Visual Basic project. Describe the various files that make up a Visual Basic project.

1-3 Chapter Objectives (2 of 2) Identify the elements in the Visual Studio environment. Define design time, run time, and debug time. Write, run, save, print, and modify your first Visual Basic project. Identify syntax errors, run-time errors, and logic errors. Use Auto Correct to correct syntax errors. Look up Visual Basic topics in Help.

1-4 Writing Windows Applications with VB (1 of 2) Windows Graphical User (GUI) Interface –Defines how elements look and function Text boxes Check box Buttons Picture box Radio buttons Label Message box

1-5 Writing Windows Applications with VB (2 of 2) Elements are called controls and are added using a toolbox. Windows are called forms.

1-6 Programming Languages—Procedural, Event Driven, and Object Oriented Procedural—Cobol, Fortran, Basic Program specifies exact sequence of all operations. Event-Driven Programming(VB 6.0 and previous) Contain some elements of object-oriented programming, but not all Object-Oriented Programming (OOP) (VB.NET) User controls sequence – Click event – Double Click event – Change event

1-7 Lego Building Blocks

1-8 The Object Model (1 of 2) In VB, you will work with objects that have properties, methods, and events. Each object is based on a class. Objects equate to Nouns. –Forms are windows. –Controls are components contained inside a form. Properties equate to Adjectives. –Color or size of a Form Methods are like Verbs. –Typical methods include Close, Show and Clear

1-9 Object Model (2 of 2) Events occur when the user takes action. –User clicks a button, User moves a form Classes are templates used to create a new object. –Classes contain the definition of all available properties, methods, and events. –Each new object created is based on a class. Creating three new buttons makes each button a instance of the Button class.

1-10 Object Model Analogy Class = automobile Properties of automobile class= make, model, color, engine, year Object = Each individual auto is an object. –Object is also an Instance of the automobile class. Methods = start, stop, speedup, slowdown Events of automobile class = Arrive, Crash

1-11 Visual Studio.NET Included in Visual Studio.NET 2008 Visual Basic (can also be purchased separately) Visual C++ C# (C sharp) J# (J sharp) F# (F sharp).NET 3.5 Framework Visual Studio.NET Editions Express Standard Professional Team System

D’s of Programming DEFINE the problem –OIP DESIGN a solution –User Interface –OEA DEVELOP/DEBUG the solution –Enter code and test DEPLOY the solution

1-13 VB Application Files One Solution File—think of one solution file equals one project: HelloWorld.sln Solution User Options File: HelloWorld.suo Form Files: HelloForm.vb Resource File for the Form:HelloForm.resx Form Designer:HelloForm.Designer.vb Project User Options File: HelloWorld.vbproj.user Once a project is run, several more files are created by the system. The only file that is opened directly is the solution file.

1-14 Visual Studio Environment The Visual Studio environment is where you create and test your projects. In Visual Studio, it is called an Integrated Development Environment (IDE) consisting of various tools including: Form Designer Editor for entering and modifying code Compiler Debugger Object Browser Help Facility

1-15 Default Environment Settings Visual Studio 2010 provides an option that allows the programmer to select the default profile for the IDE. Use General Development as the default profile.

1-16 The IDE Initial Screen The Visual Studio IDE with the Start Page open, as it first appears in Windows XP, without an open project

1-17 IDE Main Window Toolbars Document Window Form Designer Solution Explorer Window Properties Window Toolbox Help Document window Properties window Solution Explorer

1-18 Solution Name Structure Sample Programs –SPnn_Teamxx_Lastname Homework Programs –HWnn_Teamxx_Lastname1_Lastname2 OIP/OEA names –SPnn_Teamxx_LN1_LN2_oip –SPnn_Teamxx_LN1_LN2_oea –HWnn_Teamxx_LN1_LN2_oip –HWnn_Teamxx_LN1_LN2_oea Where nn is the homework number Where xx is the team number

1-19 Tool Box You can scroll to view more controls. To sort the tools in the toolbox: Right-click the toolbox and select. Sort Items Alphabetically from the context menu (shortcut menu).

1-20 Modes Design Time — used when designing the user interface and writing code Run Time — used when testing and running a project Break/Debug Time — if/when receiving a run-time error or pause error "Look at the Title Bar"

1-21 Your First VB Program Create a program that will allow the user to press a button (Push ME) and display a message (Hello World) on the screen. When the user presses the Exit button, the program will terminate.

1-22 Define – OIP Form OUTPUT INPUT PROCESS

1-23 User Interface Design Set up the form. – Resize the form, set certain properties, and change the form file name to helloWorldForm. – Place button controls on the form using the toolbox and set their properties. – Place a label on the form using the toolbox and set its properties. – Lock the Controls in place.

1-24 Naming Rules and Conventions Have a set of standards and always follow them. No spaces, punctuation marks, or reserved words Use camel casing. Examples – messageLabel – exitButton – dataEntryForm – paymentAmountTextBox

1-25 Naming Conventions Object ClassExampleHungarian Notation FormdataEntryForm frmDataEntry ButtonexitButton btnExit LabeltotalLabel lblTotal TextBoxpaymentAmountTextbox txtPaymentAmount Radio buttonboldRadiobutton rdbBoldd CheckBoxprintSummaryCheckBox chkPrintSummary Horizontal Scroll BarrateHorizontalScrollBar hsbRate Vertical Scroll BartemperatureVerticalScrollBar vsbTemperature PictureBoxlandscapePictureBox picLandscape ComboBoxbookListComboBox cboBookList ListBoxingredientsListBox lstIngredients SoundPlayerintroPageSoundPlayer sndIntroPagesound

1-26 Setting the Form Properties The default startup object is Form1 The name of the form should always be changed to adhere to naming rules The properties window shows the files properties

1-27 Form’s Screen Location You can set the form’s screen position by setting the StartPositionproperty of the form. To center a form on the user’s screen, set the StartPosition property to CenterScreen.

1-28 Setting Properties Button 1 NamepushMeButton TextPush Me Button 2 NameexitButton TextExit Label 1 NamemessageLabel Textleave blank Form NamehelloWorldForm TextHello World by your name

1-29 Chapter 3: Program Design and Coding 29 Design – OEA Form OBJECTEVENTTASK(S)

1-30 Writing the Code While the project is running, the user can perform actions. Each action by the user causes an event to occur. Write code for the events you care about; the events you want to respond to with code. Code is written as event procedures. VB will ignore events for which you do not write code. VB will automatically name event procedures as the object name, an underscore(_) and the name of the event.

1-31 More on Writing the Code When writing the code for your first project, you will use the following: Remark Statement Assignment Statement Ending a Program Editor Window

1-32 Editor Window Declarations Section Class list Method list

1-33 Ending a Program Methods always have parentheses. (This will help you distinguish them from Properties which never have parentheses.) To execute a method of an object you write: Object.Method() Current Form may be referenced as Me Close( )

1-34 Remark Statement Also known as Comment, used for documentation; every procedure should begin with a remark statement providing explanation. Non-executable Automatically colored Green in Editor Begins with an apostrophe ( ' ) On a separate line from executable code At the right end of a line of executable code 'Display the Hello World message.

1-35 Assignment Statement Assigns a value to a property or variable Operates from right to left — the value appearing on the right side of the equal sign is assigned to the property named on the left of the equal sign. Enclose text strings in quotation marks (" ") MessageLabel.Text=" Hello World "

1-36 Run, Save, Modify, Print, Test, Debug, and Execute Run Project Open Debug Menu, Start Debugging. Start Debugging button on the toolbar. Press F5, the Start Debugging command. Save Project — File Menu, Save All. Modify Project if needed. Print the Code. Correct any Errors and Rerun. When you start executing your program, the first step is called compiling, which means that the VB statements are converted to Microsoft Intermediate Language (MSIL). Your goal is to have no errors during the compile process: a clean compile. "Help is always available from the Help Menu or by pressing F1."

1-37 Print the Code File Menu, Print Prints complete code listing Uses arrow symbol to denote line continuation

1-38 Finding and Fixing Errors Syntax Errors Breaks VB’s rules for punctuation, format, or spelling Smart editor finds most syntax errors, compiler finds the rest. The editor identifies a syntax error with a squiggly blue line and you can point to an error to pop up the error message. You can display the Error List window and line numbers in the source code to help locate the error lines. Run-Time Errors Statements that fail to execute, such as impossible arithmetic operations Logic Errors Project runs, but produces incorrect results.

1-39 Submitting Homework Compress the solution folder Log on to Angel Locate Drop Box for assignment Upload the compressed file Submit

1-40 Visual Studio Help Additional Info (1 of 2) Visual Studio has an extensive Help facility. Filter MSDN help to display VB topics only. Run MSDN from hard drive, CD, or Web. You can access MSDN on the Web at The Help system display is greatly changed and improved in Visual Studio You view the Help topics in a separate window web browser from the VS IDE, so you can have both windows opened at the same time.

1-41 Visual Studio Help Additional Info (2 of 2) The opening Help page allows you to search for a topic, or to choose from a list of topic areas such as: Welcome to Visual Studio 2010, Documentation, What’s New, Walkthroughs, etc.