Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Intrinsic Functions Pre-coded Functions Used to improve developer productivity Broad Range of Activities Math calculations Time/Date functions String."— Presentation transcript:

1

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

3 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

4 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”) 23.5 32 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.456)123

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

6 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”)

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

8 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)

9 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

10 Interface

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

12 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

13 Convert to Number Format to Currency


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

Similar presentations


Ads by Google