Showing posts with label subs. Show all posts
Showing posts with label subs. Show all posts

Sunday, 22 July 2012

subs in vb.net

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

    Sub givemessage()
        MessageBox.Show("I am cool for using subs")
    End Sub

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

End Class

Saturday, 28 January 2012

How to call sub in vb.net?


How to call sub in vb.net?
In this tutorial you can learn how to use sub and sub procedure.
Step1:
Open Microsoft visual studio
Step2:
File newà windows form application àrename it as
Step3:
Write or copy the below code
Code:
Public Class Form1

    Private SubButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton1.Click
        Call callthesubmenu()
    End Sub
    Sub callthesubmenu()
        Form2.Show()
    End Sub
End Class

Step5:
Output: