Visual Basic Intrinsic Functions Intrinsic Functions Precoded Functions
![Visual Basic - Intrinsic Functions Visual Basic - Intrinsic Functions](https://slidetodoc.com/presentation_image_h/7a5a298464483f56407358654d6fb0e9/image-1.jpg)
Visual Basic - Intrinsic Functions
![Intrinsic Functions Pre-coded Functions Used to improve developer productivity Broad Range of Activities Math Intrinsic Functions Pre-coded Functions Used to improve developer productivity Broad Range of Activities Math](http://slidetodoc.com/presentation_image_h/7a5a298464483f56407358654d6fb0e9/image-2.jpg)
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 ALWAYS return a value You MUST do something with the value that Intrinsic Functions ALWAYS return a value You MUST do something with the value that](http://slidetodoc.com/presentation_image_h/7a5a298464483f56407358654d6fb0e9/image-3.jpg)
Intrinsic 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 Function Description Example Result CDbl Returns a double if the Examples of Intrinsic Functions Function Description Example Result CDbl Returns a double if the](http://slidetodoc.com/presentation_image_h/7a5a298464483f56407358654d6fb0e9/image-4.jpg)
Examples of Intrinsic Functions Function Description Example Result CDbl Returns a double if the item can be converted (can handle currency) CDbl (“ 23. 5”) CDbl (“$32. 00”) CDbl (“hello”) 23. 5 32 Type Mismatch Error Val Returns the numbers contained in the parenthesis (stops at 1 st non numeric item) Val (txt. Input. text) Val (“$32. 00”) Val (“hello”) Number from textbox 0 0 Str Converts a number to a String Str (123) “ 123” Is. Numeric Returns true if the items can be converted to a number Is. Numeric (“ 23. 5”) Is. Numeric (txt. Input. text) Is. Numeric(“hello”) True Returns the integer part of a number Int (123. 456) 123 Int False
![Examples of Intrinsic Functions Function Description Example Format. Number Formats a number to a Examples of Intrinsic Functions Function Description Example Format. Number Formats a number to a](http://slidetodoc.com/presentation_image_h/7a5a298464483f56407358654d6fb0e9/image-5.jpg)
Examples of Intrinsic Functions Function Description Example Format. Number Formats a number to a Format. Number (8765. 4534) specified decimal point Format. Number (8765. 4534, 3) (default of 2) Result 8, 765. 453 Format. Currency Formats a number with Format. Currency (76) a dollar sign & cents Format. Currency (245879. 358) $76. 00 $245, 879. 36 Format. Percent 78. 40% 820. 00% Formats a number as a percent Format. Percent (. 784) Format. Percent (8. 2)
![More Intrinsic Functions Input. Box Prompts the user for keyboard input Input is returned More Intrinsic Functions Input. Box Prompts the user for keyboard input Input is returned](http://slidetodoc.com/presentation_image_h/7a5a298464483f56407358654d6fb0e9/image-6.jpg)
More Intrinsic Functions Input. Box Prompts the user for keyboard input Input is returned to the program for processing Syntax: Result = Input. Box (prompt, [title]) Example: str. Input = Input. Box (“Enter Input”, “Input”) str. Name = Input. Box (“What is your name”)
![One More Intrinsic Function Msg. Box Displays a message in a dialog box Syntax One More Intrinsic Function Msg. Box Displays a message in a dialog box Syntax](http://slidetodoc.com/presentation_image_h/7a5a298464483f56407358654d6fb0e9/image-7.jpg)
One More Intrinsic Function Msg. Box Displays a message in a dialog box Syntax Msg. Box (prompt) Example: Msg. Box (“Hello World”) Msg. Box (“The Result is “ & Result)
![Example Create an application that adds items to a sales receipt one at a Example Create an application that adds items to a sales receipt one at a](http://slidetodoc.com/presentation_image_h/7a5a298464483f56407358654d6fb0e9/image-8.jpg)
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 TASK OBJECT EVENT Input Price Text Box, Label None Display Receipt List TOE Chart TASK OBJECT EVENT Input Price Text Box, Label None Display Receipt List](http://slidetodoc.com/presentation_image_h/7a5a298464483f56407358654d6fb0e9/image-9.jpg)
TOE Chart TASK OBJECT EVENT Input Price Text Box, Label None Display Receipt List Box None Display Subtotal Label, Label None Display Sales Tax Label, Label None Display Total Label, Label None Add Item to Receipt Button Click Exit Button Click
![Interface Interface](http://slidetodoc.com/presentation_image_h/7a5a298464483f56407358654d6fb0e9/image-10.jpg)
Interface
![Code Variables Subtotal Tax Total What Data Types? Where to Declare? Code Variables Subtotal Tax Total What Data Types? Where to Declare?](http://slidetodoc.com/presentation_image_h/7a5a298464483f56407358654d6fb0e9/image-11.jpg)
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 Add to Receipt Button Read in Data from Text Box Convert to Number CDbl](http://slidetodoc.com/presentation_image_h/7a5a298464483f56407358654d6fb0e9/image-12.jpg)
Add to Receipt Button Read in Data from Text Box Convert to Number CDbl Val Input into List. Box Formatted as Currency Update Subtotal, Tax, Total & Displays
![Convert to Number Format to Currency Convert to Number Format to Currency](http://slidetodoc.com/presentation_image_h/7a5a298464483f56407358654d6fb0e9/image-13.jpg)
Convert to Number Format to Currency
- Slides: 13