In this tutorial, we cover the Function and how it works. Similar to the sub procedure, a function is also a method which stores code to be executed when called. The difference is a function returns a value where a sub procedure doesn’t. When merging more than one code block simply call function name and pass arguments.
Copy and paste below Code:
Public Class Form1 Dim labeltext As String = "functions are cool lol" Private Function changelabeltext() Return labeltext End Function Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label1.Text = changelabeltext() End Sub End Class