Working with Function Procedures

Function procedures are similar to sub procedures, with one key difference: They return a value. This means that somewhere in the body of the function procedure, a value will be calculated, retrieved, or otherwise created and set to be the function’s return value. This value can subsequently be used by the calling code; typically, it is assigned to a variable or used in expressions. Visual Basic offers a number of built-in functions that you can use, such as Val, which returns the numeric representation of a string, or Left, which returns a specified number of characters from the left end of a string. Function procedures let you build your own custom functions as well.

Building a Function

To build a function, ...

Get Special Edition Using Microsoft® Visual Basic® .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.