There are two types of methods in VB .NET:
those that return a value (Functions)
and those that do not return a value (Sub Procedures)
Sub Procedures ( do not return a value )
--------------------
Sub Main()
'sub procedure Main() is called by default
Display()
'sub procedure display() which we are creating
End Sub
Sub Display()
MsgBox("Using Sub Procedures")
'executing sub procedure Display()
End Sub
Functions ( return a value )
-------------
Sub Main()
Write("Sum is" & " " & Add())
'calling the function
End Sub
Public Function Add() As Integer
'declaring a function add
Dim i, j As Integer
'declaring two integers and assigning values to them
i = 10
j = 20
Return (i + j)
'performing the sum of two integers and returning it's value
End Function
Hope this post will help you,
Rajesh Singh
Asp.Net Developer
Indianic Infotech Ltd (India)
Rajesh@indianic.com
Subscribe to:
Post Comments (Atom)
Post a Comment