18-Subs

0
487

This Visual Basic Tutorial is all about Subs.
In Visual Basic, a Sub procedure is a series of statements composed by the Sub and End Sub statements. It performs a task that returns control to the calling code, but it does not return any value. it is also used to declare the name, parameter and the body of a sub procedure.

This is the syntax in declaring a parameter in the parameter list:

[Optional] [ByVal | ByRef] [ParamArray] parametername As datatype

You can also visit this site for the advanced tutorial in declaring parameter list. Click Here

This is syntax in performing a Sub statement:

[Modifiers] Sub SubName [(ParameterList)]

Statements…..

End Sub

Example:

Step 1: Create a Subroutine then add the code below:

Step 2: Add a button and add the code below.

This code will call the subroutine.

Readers might read also:

 

Facebook Comments

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.