Wednesday, 9 February 2011

Sub Routines

What is a sub routine?

A sub routine is where you write your code, here's an example on how to write a sub routine, and then how you call it.

Private sub HelloWorld()

MsgBox("Hello World")

End Sub

And here's how you would call it.

Private Sub Button1_Click(ByVal sender As System. _
                                                         Object, ByVal e As System.EventArgs) Handles Button1.Click

Call HelloWorld()

End Sub


It's very simple, sub routines are very nifty, writing our code in there makes it a lot easier to see the difference in the code, instead of us having to write all our code under the individual buttons.

-Rasmus Iversen

No comments:

Post a Comment