In this tutorial, we cover the Sub or Sub Procedure in Visual Basic .NET. Creating a sub is a way of storing lines of code and then executing the lines of code inside of the sub when it is called. This tutorial we will show you how to store code for a message box in a sub and then call it when clicking a button.
Copy and paste below Code:
Public Class Form1
MessageBox.Show("I am cool for using subs")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click