BC30812: Optional parameters must specify a default value

Optional parameters must provide default values that can be used if no parameter is supplied by a calling procedure.

Error ID: BC30812

Example

The following example generates BC30812:

Sub Proc1(x As Integer, Optional y As String)
    Console.WriteLine("Default argument is: " & y)
End Sub

To correct this error

Specify default values for optional parameters:

Sub Proc1(x As Integer, Optional y As String = "Default Value")
    Console.WriteLine("Default argument is: " & y)
End Sub

See also