Intrinsic Functions Pre-coded Functions Used to improve developer productivity Broad Range of Activities Math calculations Time/Date functions String.

Slides:



Advertisements
Similar presentations
Lists, Loops, Validation, and More
Advertisements

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 5- 1 STARTING OUT WITH Visual Basic 2008 FOURTH EDITION Tony Gaddis.
Programming with Microsoft Visual Basic th Edition
Chapter 3: Using Variables and Constants Programming with Microsoft Visual Basic 2005, Third Edition.
Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
IMS1906 Programming in VB.NET Week 3 – Lecture 1 Application Development © Angela Carbone Monash University School of Information Management.
Input Validation Check the values entered into a text box before beginning any calculations Validation is a form of ‘self-protection’, rejecting bad data.
Input and Message Boxes. InputBox() Function An input box is a dialog box that opens and waits for the user to enter information. Syntax: InputBox(prompt[,title][,default])
CSC110 Fall Chapter 5: Decision Visual Basic.NET.
Input Validation Check the values entered into a text box before beginning any calculations Validation is a form of ‘self-protection’, rejecting bad data.
Repeating Program Instructions Chapter Microsoft Visual Basic.NET: Reloaded 1.
Chapter Three Using Variables and Constants Programming with Microsoft Visual Basic th Edition.
Input/Output CE 311 K - Introduction to Computer Methods Daene C. McKinney.
MIS 3200 – Unit 6.2 Learning Objectives How to move data between pages – Using Query Strings How to control errors on web pages – Using Try-catch.
Chapter 3: Using Variables and Constants
Programming with Microsoft Visual Basic th Edition CHAPTER THREE USING VARIABLES AND CONSTANTS.
CS0004: Introduction to Programming Input and Output.
Repetition Statements Repeating an Action A specified number of times While a Condition is True Until a Condition is True.
Problem Create a Windows-based application that will calculate the Gross Pay earned for a worker, given the number of hours worked and hourly pay rate.
1 Chapter 3 – Variables, Input, and Output 3.1 Numbers 3.2 Strings 3.3 Input and Output.
CIS 115 Lecture 8. There are 3 control structures common to most computer languages that determine the flow, or path of execution, of the code:  Sequential.
Agenda  Commenting  Inputting Data from Keyboard (scanf)  Arithmetic Operators  ( ) * / + - %  Order of Operations  Mixing Different Numeric Data.
Chapter 12: How Long Can This Go On?
3 - Variables Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
Input Textboxes Input Boxes Different than textboxes Good for small amount of input (form full of textboxes is not nice) X = Inputbox(“prompt message”,
Arrays Chapter 8. Chapter 8 - Part 12 Variable and Variable Array Variable Stores only one value Variable Array Variable that has 1 symbolic name but.
Numbers continued The Integer Data Type Multiple Declarations Parentheses Three Types of Errors.
Variables When programming it is often necessary to store a value for use later on in the program. A variable is a label given to a location in memory.
Chapter 8 - Visual Basic Schneider
CS 101 Test 2 Study Guide Acronyms RAD - Rapid Application Development IDE - Integrated Development Environment GUI - Graphical User Interface VB - Visual.
Variables & Function Calls. Overview u Variables  Programmer Defined & Intrinsic  Data Types  Calculation issues u Using Functions  The val() function.
Dialog Boxes.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Three Using Variables and Constants.
1 Chapter 3 – Examples The examples from chapter 3, combining the data types, variables, expressions, assignments, functions and methods with Windows controls.
Pay Example (PFirst98) Please use speaker notes for additional information!
Hungarian Notation A must in this course Every object used MUST be renamed including the form(s) using the following rules Form  frmFormName E.g. frmTemperature.
Chapter 4 Getting Started with VBA. Subroutines Subroutine is the logical section of code that performs a particular task. Subroutine is also called a.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 13 How Long Can This Go On?
Controlling Program Flow with Looping Structures
Slide 1 Controls v Control naming convention –Label: lblName –Command Button: cmdName –Text Box: txtName.
HNDIT Rapid Application Development
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Student Grades Application Introducing Two-Dimensional Arrays and RadioButton.
Visual Basic.net Functions. Function (Defined) A procedure that returns a value when called.
Variables and Expressions Programming Right from the Start with Visual Basic.NET 1/e 7.
Knowledge Base. Defining a Variable Dim statement Dim intXX As Integer Public in a Module Public dblNN As Double.
Creation of Variables with Numeric, alphanumeric, date, picture, memo data types Constant - A quantity that does not change during the execution of a program.
Visual Basic 6 Programming Decide how many variables you need by looking at this form. There is one textbox for input and there are 3 labels for output,
Looping Structures. A B dialog box that pops up and prompts the user for input Text area that pops up and prompts the user for to wait while it gets.
CSC 162 Visual Basic I Programming. String Functions LTrim( string ) –Removes leading spaces from the left side of string RTrim( string ) –Removes trailing.
Making Interactive Programs with Visual Basic .NET
Chapter 4.  Variables – named memory location that stores a value.  Variables allows the use of meaningful names which makes the code easier to read.
Programming with Microsoft Visual Basic 2012 Chapter 3: Using Variables and Constants.
© 2006 Lawrenceville Press Slide 1 Chapter 4 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration.
Visual Basic Declaring Variables Dim x as Integer = 0 In the statement above, x is being declared as an Integer (whole number) and is initialised.
Chapter 6 Controlling Program Flow with Looping Structures.
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”
Input, Output and Variables GCSE Computer Science – Python.
A variable is a name for a value stored in memory.
Using the Console.
Chapter 3: Using Variables and Constants
Chapter (3) - Looping Questions.
CIS 16 Application Development Programming with Visual Basic
Input and Output.
Prepared By: Deborah Becker
Additional Topics in VB.NET
JavaScript.
Input and Output.
Visual Basic Numbers Chapter 3.3 Prepared By: Deborah 7/9/2019.
Input and Output Chapter 3.5
Presentation transcript:

Intrinsic Functions Pre-coded Functions Used to improve developer productivity Broad Range of Activities Math calculations Time/Date functions String formatting Many more

Intrinsic Functions Functions ALWAYS return a value You MUST do something with the value that is returned Right hand side of an assignment statement Part of an Output Statement

Examples of Intrinsic Functions FunctionDescriptionExampleResult CDblReturns a double if the item can be converted (can handle currency) CDbl (“23.5”) CDbl (“$32.00”) CDbl (“hello”) Type Mismatch Error ValReturns the numbers contained in the parenthesis (stops at 1 st non numeric item) Val (txtInput.text) Val (“$32.00”) Val (“hello”) Number from textbox 0 StrConverts a number to a String Str (123)“123” IsNumericReturns true if the items can be converted to a number IsNumeric (“23.5”) IsNumeric (txtInput.text) IsNumeric(“hello”) True False IntReturns the integer part of a number Int ( )123

Examples of Intrinsic Functions FunctionDescriptionExampleResult FormatNumberFormats a number to a specified decimal point (default of 2) FormatNumber ( ) FormatNumber ( , 3) 8, , FormatCurrencyFormats a number with a dollar sign & cents FormatCurrency (76) FormatCurrency ( ) $76.00 $245, FormatPercentFormats a number as a percent FormatPercent (.784) FormatPercent (8.2) 78.40% %

More Intrinsic Functions InputBox Prompts the user for keyboard input Input is returned to the program for processing Syntax: Result = InputBox (prompt, [title]) Example: strInput = InputBox (“Enter Input”, “Input”) strName = InputBox (“What is your name”)

One More Intrinsic Function MsgBox Displays a message in a dialog box Syntax MsgBox (prompt) Example: MsgBox (“Hello World”) MsgBox (“The Result is “ & Result)

Example Create an application that adds items to a sales receipt one at a time using an input text box and a button. Each time the button is pressed, the new item price should be added to a list box control which acts as a receipt. The program should also contain output labels for subtotal, sales tax and total that should be updated when an item is added to the receipt. (Ensure that the prices are numeric and that the output is formatted to currency)

TOE Chart TASKOBJECTEVENT Input PriceText Box, LabelNone Display ReceiptList BoxNone Display SubtotalLabel, LabelNone Display Sales TaxLabel, LabelNone Display TotalLabel, LabelNone Add Item to ReceiptButtonClick ExitButtonClick

Interface

Code Variables Subtotal Tax Total What Data Types? Where to Declare?

Add to Receipt Button Read in Data from Text Box Convert to Number CDbl Val Input into ListBox Formatted as Currency Update Subtotal, Tax, Total & Displays

Convert to Number Format to Currency