Chapter 1 Introduction to Visual Basic.NET Programming In Visual Basic.NET © 2001 by The McGraw-Hill Companies, Inc. All rights reserved.

Slides:



Advertisements
Similar presentations
1-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Advertisements

Introduction to Visual Basic.NET Uploaded By: M.Sheraz anjum.
1-1 Chapter 1 Introduction to Visual Basic 2010 Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
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,
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.
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.
Outline Review Visual Basic.NET Environment Review Visual Basic.NET Environment First Visual Basic Planning and Programming First Visual Basic Planning.
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.
Visual Basic 2008 Express Edition The IDE. Visual Basic 2008 Express The Start Page Recent Projects Open an existing project Create a New Project.
Lecture 2 Introduction to Visual Basic.NET Programming Appreciation.
A First Program Using C#
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.
Introduction to VB.NET Tonga Institute of Higher Education.
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
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
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
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.
Introduction to Visual Basic.NET Programming In Visual Basic.NET.
Introduction to Visual Basic.NET Chapter 2 Introduction to Controls, Events.
Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment.
Introduction to the Visual Studio.NET IDE (LAB 1 )
 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.
Introduction to Visual Basic.NET Your First Visual Basic.NET Application.
Program Design and Coding
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
Microsoft Visual Basic 2010 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 Comprehensive Concepts and Techniques Chapter 8 Debugging, Creating Executable Files, and Distributing a Windows Application.
1.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 5.1 Test-Driving the Inventory Application.
Hands-on Introduction to Visual Basic.NET Programming Right from the Start with Visual Basic.NET 1/e 6.
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter One An Introduction to Visual Basic 2008.
BBT 10 Visual Basic 03 Enrichment. Tip Before creating any files for your project, first create a new folder Save all of your files in the folder Pieces.
Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Chapter 2 Introduction to Visual Basic Programming Visual Basic.NET.
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Introduction to Visual Basic 2008 Chapter 1.
Lecture Set 2 Part A: Creating an Application with Visual Studio – Solutions, Projects, Files 8/10/ :35 PM.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 3 Building an Application in the Visual Basic.NET 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.
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.
Dive Into® Visual Basic 2010 Express
Visual Basic.NET Windows Programming
Chapter 2: The Visual Studio .NET Development Environment
Chapter 1: An Introduction to Visual Basic 2015
Using Procedures and Exception Handling
Hands-on Introduction to Visual Basic .NET
CIS16 Application Development Programming with Visual Basic
Visual Studio.
Presentation transcript:

Chapter 1 Introduction to Visual Basic.NET Programming In Visual Basic.NET © 2001 by The McGraw-Hill Companies, Inc. All rights reserved.

1- 2 Writing Windows Applications with VB Windows uses a Graphical User Interface to interact with the user Visual Basic terms a Window = Form In the VB editor the Toolbox holds all of the Controls you will use in order to build a form –Text Box –Label –Check Box –Button

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Programming Languages Procedural –Program specifies exact sequence Event Driven (VB 6.0 and previous) Object Oriented Programming (VB.NET) –User controls sequence Click event Double Click event Change event

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Object Model Object ==> Noun –Form and Controls Property ==> Adjective –Color of a Form Method ==> Verb –Move a Form

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Object Model (cont.) Event ==> Occur when the user takes action –User clicks a button, User moves a form Class ==> Template to create new object –Each control added is an Instance of a Class

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Dot Notation Used to reference object's properties and methods in code –Object dot Property Form1.Text TextBox1.Text –Object dot Method Form1.Hide( ) TextBox1.Focus( )

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Object Model Analogy Class = automobile Properties = make, model, color, year Object = each individual car –Object is also an Instance of the automobile class Methods = start, stop, speedup, slowdown Events = car arrives, car crashes

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Visual Basic.NET Included in Visual Studio.NET –Visual Basic (can also be purchased separately) –C++ –C# –.NET Framework Complete rewrite from VB Version 6

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Visual Studio.NET Editions Academic Professional Enterprise Developer Enterprise Architect

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Steps for Writing VB Projects Design and Create the User Interface Set the Properties for the controls Write the Code for the events Test and Debug

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Open this file directly to work on a Project VB Application Files One Solution File.sln Solution User Options File.suo Project Files.vbproj Project User Options File.vbproj.user Form Files.vb Resource File for the Form.resx

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Visual Studio Environment The environment consist of the following: –Integrated Development Environment (IDE) –Form Designer –Editor for entering code –Compiler –Debugger –Object Browser

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Visual Studio IDE Start Page

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved IDE New Project Dialog

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved IDE Main Window Toolbars Document Window Form Designer Solution Explorer Properties Window Toolbox

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved IDE Main Window

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved VB Toolbox Holds the tools you place on a form

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Visual Studio Help Extensive Help feature Includes Microsoft Developer Network library (MSDN) Entire reference manual Coding examples

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Different Modes of Operation Design Time Run Time Break Time “Look at the Title Bar”

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Naming Rules (p 51-52) Always use standard names for objects No spaces or punctuation marks are allowed 3 letter lowercase prefix identifies the control type Button - btn Label - lbl Form - frm If the identifier contains multiple words capitalize the 1st letter of each word –txtFirstName

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Recommended Naming Conventions for VB Objects Object ClassPrefixExample FormfrmfrmDataEntry ButtonbtnbtnExit TextBoxtxttxtPaymentAmount LabellbllblTotal Radio ButtonradradBold CheckBoxchkchkPrintSummary Horizontal ScrollBarhsbhsbRate Vertical ScrollBarvsbvsbTemperature PictureBoxpicpicLandscape ComboBoxcbocboBookList ListBoxlstlstIndegredients

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Hello World Project Design the User Interface Create a new project and set the Project Name to HelloWorld Add the controls on the form like you see them below

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Properties Window-Label1 Rename Label1 to lblMessage

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Set the Properties Label –NamelblMessage –Textleave blank Button 1 –NamebtnPush –TextPush Me Button 2 –NamebtnExit –TextExit Form –NamefrmHello –TextHello World by your name

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Set the Project's Startup Object The default startup object is Form1 The name of the form should always be changed to adhere to naming rules Using Project menu, Properties change the startup object to match the new name

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Project Property Page Dialog

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Write 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, in other words the events you want to respond to Code is written as event procedures VB will ignore events for which you do not write code

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Editor Window Declarations Section Class list Method list

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved ' Display the Hello World message Remark Statement Also known as Comment, you use a remark for documentation They are Non-executable lines All remarks will be removed from the code inside the exe 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

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Private Sub btnPush_Click(ByVal …, ByVal...) Handles btnPush.Click 'Display the Hello World message lblMessage.Text = "Hello World" End Sub Assignment Statement Assigns a value to a property or variable Operates from right to left Enclose text strings in quotation marks (" ") Add the code below to your project

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Ending a Program Execute the Close Method of the Form Methods always have parentheses (this will help you distinguish them from Properties which never have parentheses) Current Form may be referenced as Me Add the code below to your project Private Sub btnExit_Click(ByVal …, ByVal …) Handles btnExit.Click 'Exit the project Me.Close() End Sub

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Test and Debug Save Project - File Menu, Save All Run Project –Debug Menu, Start –Start Without Full Compile (F5) –Start With Full Compile(CTRL F5) Correct any Errors and Rerun –Compile errors –Run-Time Errors –Logic errors –Syntax errors "Help is always available from the Help Menu or by pressing F1."

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Print the Code File Menu, Print Prints complete code listing Uses arrow symbol to denote line continuation Examine sample output on page 37

© 2001 by The McGraw-Hill Companies, Inc. All rights reserved Finding and Fixing Errors Pages Syntax Errors Run-Time Errors Logic Errors