Skip this Video
Download Presentation
Val Function

Loading in 2 Seconds...

play fullscreen
1 / 5

Val Function - PowerPoint PPT Presentation

  • Uploaded on

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'Val Function' - breck

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Val FunctionA Function performs anaction and returns a valueThe expression to operate upon, known as the argument, (or multiple arguments), must be enclosed in parenthesesVal an abbreviation for valueVal(ExpressionToConvert)The expression that is converted, can be the Property of a Control, a Variable, or a Constant
The Val Function returns (produces) a value that can be used as a part of a statement, such as an assignment statementiQuantity = Val(txtQuantity.Text)The Val Function converts an argument to numeric, by beginning at the Left-Most CharacterIf that character is a numeric digit, decimal point, or sign, Val converts the character to numeric and moves to the next character. As soon as a non-numeric character is found, the operation stops
Conversion FunctionThe Conversion Function checks if the value stored in the Property of a Control or a Variable is of a specific Data Type required in the execution of a statement(s), and if not the Conversion Function will return a ‘Run-Time Error’ Message The Text in Text Boxes is treated as a String, however in performing Arithmetic Operations (such as ^ * / + -), numeric values are required in the Text property of the Text Boxes
VB Conversion FunctionsCInt - Converts a value to an Integer CLng - Converts a value to a Long Integer CSng - Converts a value to a Single Precision number CDbl - Converts a value to a Double Precision nember CCur - Converts a value to Currency CStr - Converts a value to a String CVar - Converts a value to a Variant
CInt FunctionDim X As IntegerX = CInt(Text1.Text)Print XDim X As Integer, Y As IntegerY = CInt(X) * 2Print YCInt(“12”) the brackets are by default - 12CInt(“Twelve”) - ErrorCInt(Text1.Text) - the value of the Text in Text1, if it is valid