The following will be an easy example for recursive function in vb .net
Module Module1
Function Recursive(ByVal value As Integer, ByRef count As Integer) As Integer
Console.WriteLine("Recursive({0}, {1})", value, count)
count = count + 1
If value >= 100 Then
Return value
End If
Return Recursive(value * 2, count)
End Function
Sub Main()
Dim count As Integer = 0
Dim total As Integer = Recursive(5, count)
Console.WriteLine("Total = {0}", total)
Console.WriteLine("Count = {0}", count)
End Sub
End Module
the output will be like ::
Recursive(5, 0)
Recursive(10, 1)
Recursive(20, 2)
Recursive(40, 3)
Recursive(80, 4)
Recursive(160, 5)
Total = 160
Count = 6