Writing Subs In VB
Sub procedures are basic programming blocks that are used to call another section of codes from virtually anywhere in the project. It allows code reuse without having to rewrite the codes again everytime that piece of codes need to be used. Unlike Functions procedures, Subs do not need to return a value to the caller. Everytime a Sub procedure is called from a line of code, The entire piece of code in the Sub will be executed until the end before proceeding to the next line of code.
The example below illustrates how a Sub Procedure works
Public Sub DisplayMessage()
MsgBox("Hello, You Called Me")
End Sub
To call the DisplayMessage Sub procedure created above, just include a line as follows in your programming codes.
DisplayMessage()
That explains how A Sub procedure works in Visual Basic.
See Also How To Write A Function

0 comments
Post a Comment