Method Overloading in Visual Basic
Which allows you to create more than one method with the same name, but with a different set of parameters. When you call the method, the CLR automatically chooses the correct version by examining the parameters you supply.
Example
Module Module1 Sub Main() Dim returnedValue As Integer Dim returnedStringValue As String 'Calling with integer returnedValue = MyFunc(100) Console.WriteLine(returnedValue) 'Calling with String returnedStringValue = MyFunc("Sample") Console.WriteLine(returnedStringValue) Console.ReadLine() End Sub ' Passing a Integer Private Function MyFunc(ByVal number1 As Integer) As Integer Return number1 + 1 End Function 'Passing a String Private Function MyFunc(ByVal string1 As String) As String Return string1 + " append" End Function End Module
Output
101 Sample append