Visual Basic.NET Programming for the Rest of Us Keith Mulbery Utah Valley State College.

Slides:



Advertisements
Similar presentations
CS0004: Introduction to Programming Visual Studio 2010 and Controls.
Advertisements

Chapter 1: An Introduction to Visual Basic 2012
Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
1.
Chapter 1: An Introduction to Visual Basic.NET Programming with Microsoft Visual Basic.NET, Second Edition.
VB Code Statements 3 types of VB statement The Remark statement, known as comments, are used for project documentation only Begin with an apostrophe Not.
CIS 115 Lecture 2.  Visual Studio 2005 Professional Edition (Requires Windows XP Pro)  MSDN Library for Visual Studio 2005 Available from MSDNAA.
Chapter Three Using Variables and Constants Programming with Microsoft Visual Basic th Edition.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter One An Introduction to Visual Basic 2010.
Chapter 3 Introduction to Event Handling and Windows Forms Applications.
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 Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
Visual Basic Chapter 1 Mr. Wangler.
Introduction to Visual Basic (VB)
Programming with Microsoft Visual Basic th Edition CHAPTER THREE USING VARIABLES AND CONSTANTS.
Chapter 4: The Selection Structure
Creating Macros Using VBA. Assigning a Macro to a Button Display the Forms toolbar. Click the Button icon. Click and drag the mouse pointer to specify.
Multiple Forms and Standard Modules
© 2006 Lawrenceville Press Slide 1 Chapter 3 Visual Basic Interface.
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.
Chapter 21 Creating Applications with Visual Basic.NET Chapter 2.
Chapter 3 Part 21 Displaying Output Chapter 3 Section 3.5Output Formatting Chapter 3 Section 3.6Group Boxes, etc. Chapter 3 Section 3.7Sample Program Chapter.
Chapter 4: The Selection Process in Visual Basic.
Intro to Programming and Visual Basic .NET
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 2 Creating a User Interface.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 5 Decision Making.
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.
 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.
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
Microsoft Visual Basic 2005 CHAPTER 4 Variables and Arithmetic Operations.
Chapter Two Creating a First Project in Visual Basic.
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 3 Variables, Constants, Methods, and Calculations.
Managing Controls Lab 2 2 All Rgihs ReservedIsmail M. Romi – PPu: IT DEpt.
Practical Programming COMP153-08S Week 5 Lecture 1: Screen Design Subroutines and Functions.
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.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 4 Working with Variables, Constants, Data Types, and Expressions.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Three Using Variables and Constants.
Programming with Microsoft Visual Basic th Edition
Chapter 4 Getting Started with VBA. Subroutines Subroutine is the logical section of code that performs a particular task. Subroutine is also called a.
Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Chapter 2 Introduction to Visual Basic Programming Visual Basic.NET.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 3 Building an Application in the Visual Basic.NET Environment.
Variables and Expressions Programming Right from the Start with Visual Basic.NET 1/e 7.
Microsoft Visual Basic 2012 CHAPTER FOUR Variables and Arithmetic Operations.
Visual Basic.Net. Software to Install Visual Studio 2005 Professional Edition (Requires Windows XP Pro) MSDN Library for Visual Studio 2005 Available.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
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 4.  Variables – named memory location that stores a value.  Variables allows the use of meaningful names which makes the code easier to read.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 6 Looping and Multiple Forms.
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 7 Multiple Forms, Modules, and Menus. Section 7.2 MODULES A module contains code—declarations and procedures—that are used by other files in a.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Programming with Microsoft Visual Basic 2012 Chapter 1: An Introduction to Visual Basic 2012.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter One An Introduction to Visual Basic 2008.
Visual Basic Fundamental Concepts
Chapter 1: An Introduction to Visual Basic .NET
PictureBox, MessageBox, Multiple Forms, Splash Screens and Timers
Visual Basic.NET Windows Programming
Microsoft Visual Basic 2005: Reloaded Second Edition
A variable is a name for a value stored in memory.
Chapter 1: An Introduction to Visual Basic 2015
Variables and Arithmetic Operations
Visual Basic..
Visual Basic Programming Chapter Four Notes Working with Variables, Constants, Data Types, and Expressions GROUPBOX CONTROL The _____________________________________.
Presentation transcript:

Visual Basic.NET Programming for the Rest of Us Keith Mulbery Utah Valley State College

Visual Basic.NET2 Object-Oriented Programming (OOP) Centered on object creation. Object: element containing data & actions Examples Form (window) object Label (descriptions) object Text Box (data entry) object Button (event driven) object Attributes (Properties) Text property (e.g., Hourly Pay Rate) Size (Height & Width) Location (Vertical & Horizontal Position)

Visual Basic.NET3 Event-Driven Programming Responds to events Action takes place in the program. User Action Examples Click or double-click a button Press a key on the keyboard System Occurrences Examples Timer Sits idle until an event occurs—again program responds to user (or system).

Visual Basic.NET4 Getting Started Sets up folder to store project; creates project With same filename Specifies drive and main folder to create program folder Shows path to project

Visual Basic.NET5 Visual Basic.NET Interface Mouse over to see Toolbox Form (interface) Design window (displays form) Form(s) within Solution Explorer Property window for selected object (currently the form) Project name Click to show properties in alpha order

Visual Basic.NET6 Form Properties Text Appears on title bar StartPosition Form location onscreen MaximizeBox and MinimizeBox True (Default) False (Dims or hides) Icon Symbol in top left corner (left of Text property)

Visual Basic.NET7 ToolBox UnpinnedPinned (stays onscreen)

Visual Basic.NET8 Controls (Objects) ControlPrefixExampleDescription FormfrmfrmMainGUI interface ButtonbtnbtnCloseRectangular object that triggers event procedure when clicked GroupgrpgrpInputBorder to organize controls LabellbllblGrossPayBox displaying text that user can’t change (descriptions & output) TexttxttxtPayRateRectangular area for data input by user

Visual Basic.NET9 Program Interface 2 Group Boxes 8 Labels 5 Descriptive 3 Output 2 Text Boxes 3 Buttons

Visual Basic.NET10 Control Name Properties txtHourlyRate txtHoursWorked lblGrossPay lblTaxes lblNetPay btnCalculate btnClear btnExit

Visual Basic.NET11 Text Property & Access Keys Shows up on the interface Uses & symbol to create access key Examples &Calculate E&xit Only 1 letter per Text property No duplicate access keys on a form (see also Tab Order in slide show)

Visual Basic.NET12 Format Menu Options

Visual Basic.NET13 Tab Order Controls order of which control has focus when user presses Tab or presses Alt and the access key Goes from descriptive label to text box

Visual Basic.NET14 Event Procedure Algorithm that executes when the event occurs. Not triggered until event occurs.

Visual Basic.NET15 Begin Program Input hourly rate Input # of hours worked Are the # of hours > 40? No Multiply the hours worked by the hourly rate. Yes Multiply 40 by the hourly rate to get the regularly weekly pay. Subtract 40 from the total hours worked to find the OT hours. Multiply the pay rate by 1.5 to get the OT rate. Multiply the OT hours by the OT rate to get the amount of OT pay. Add the regular weekly pay and the OT pay. Display gross pay End Program

Visual Basic.NET16 Begin Program Input hourly rate Input # of hours worked Are the # of hours > 40? No Multiply the hours worked by the hourly rate. Yes Multiply 40 by the hourly rate to get the regularly weekly pay. Subtract 40 from the total hours worked to find the OT hours. Multiply the pay rate by 1.5 to get the OT rate. Multiply the OT hours by the OT rate to get the amount of OT pay. Add the regular weekly pay and the OT pay. Display gross pay End Program

Visual Basic.NET17 Exit Event Procedure Keywords in blue Control name Event Keyword that terminates the program Comments document (explain the program); use plenty of them; start with an apostrophe; appear in green

Visual Basic.NET18 Clear Button Event Pseudocode

Visual Basic.NET19 Clear Event Procedure Clear user input (text boxes) txtBoxName.Clear Clear output (labels) lblLabel.Text=“” Set focus to the 1st text box for for next transaction

Visual Basic.NET20 Constants and Variables Constant Value that does not change (such as tax rate) Declare to avoid magic numbers (typed numbers in statements) Variables Memory locations that hold data that can change during the program’s operation Use to store input, manipulate, and hold resulting values

Visual Basic.NET21 Data Types Numeric Double Single Integer Decimal String

Visual Basic.NET22 Constant Declaration Const dblLOW_TAX_RATE As Double = 0.15 Const is keyword for Constant dbl is data type prefix LOW_TAX_RATE is descriptive name; all caps with underscores As Double is the data type declaration 0.15 is the number

Visual Basic.NET23

Visual Basic.NET24 Variable Declaration Dim dblHourlyRate As Double Dim stands for “Dimension” dbl is the data type prefix for Double HourlyRate is descriptive name; use camel casing; not all caps; no underscores As Double is the data type

Visual Basic.NET25

Visual Basic.NET26 Variable Assignment Get user input Store as a value into a numeric variable

Visual Basic.NET27 If Statements If condition Then statement block if condition is true Else statement block if condition is false End If Condition Logical Test sngHours <= intBASE_HOURS

Visual Basic.NET28 Calculate Gross Pay Use line continuation character (space and _) to word-wrap statements for readability Use mathematical operators (* / + -) Apply order of precedence Group by parentheses

Visual Basic.NET29 Determine Tax Rate & Tax Amount $0 to $40015% $ to $75022% $ and up30%

Visual Basic.NET30 Calculate Net Pay Subtract the contents of the dblTaxes variable from the contents of the dblGrossPay variable Store result in dblNetPay variable

Visual Basic.NET31 Display Output in Output Labels Display output in label Text properties Format the output for currency

Visual Basic.NET32 GotFocus Event Procedure For each text box—selects existing contents (white on blue)

Visual Basic.NET33 Message Boxes Display information (such as error messages) to the user MessageBox.Show("Message","Caption",Buttons,Icon) Message—what you want to say to user Caption—what appears on the title bar Buttons—what buttons, such as OK, to appear Icon—visual symbol

Visual Basic.NET34 MessageBox.Show("Message","Caption",Buttons,Icon) MessageBoxIcon.Information MessageBoxIcon.Asterisk MessageBoxIcon.Error MessageBoxIcon.Stop MessageBoxIcon.Warning MessageBoxIcon.Exclamation MessageBoxIcon.Question

Visual Basic.NET35 Validation Procedure

Visual Basic.NET36 Call Validation Procedure In event procedure, after declarations, but before assignments Boolean variable (True or False); set it as a flag that there is a problem

Visual Basic.NET37 Form Naming Project>Properties

Visual Basic.NET38 Add New Form for Splash Screen Click Add New Item on toolbar. Keep the.vb extension

Visual Basic.NET39 Form Load for Main Form

Visual Basic.NET40 Splash Screen TopMost Property: True Timer Control Enabled Property: True Interval Property: 3000