Methods

Methods represent actions and are the .NET equivalent of what in other programming environments are called functions and procedures. A method can be a member of classes, structures, and modules. Methods that return a value are represented by Function..End Function blocks, such as the following:

Function DoSomething() As String      Return "A text message"End Function

Methods that do not return a value are represented by Sub..End Sub blocks, such as the following:

Sub DoSomething()'write your code hereEnd Sub

Methods can receive parameters that can be processed within code blocks. Such parameters are called, in .NET terminology, arguments. The following code block shows an example of an argument named message ...

Get Visual Basic 2015 Unleashed 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.