Does anyone know how to call a method and pass an optional parameter? Where is this in the documentation? Thanks in advance!
Sub MyMethod (param As String = "")
Sub MyMethod (ParamArray param() As String)
Sub MyMethod (Optional param As String)
I like the first form unless I need an unlimited number of parameters, then the second form. I never use the third form.
Do They allow me to call the method without passing anything like:
Call MyMethod
You only need Call if the method will return a value, meaning it’s a function. It has nothing to do with the params you supply or are required or optional.
Basically if in your method declaration you also provide a default value, then the parameter is optional.
Thanks everyone!