When you will call the AddToLog method, depending on which parameter you specify, the correct overloads will be used.
If you call the method with only one string parameter the first overload will be used.
If you call the method with a string and a control parameters, the second overload will be used.
You don't have to specify this. It is exactly like when you call the msgbox method. You have multiple overloads and the correct one is used automatically.
>>I think your problem is the default value you need to give to the optional parameter.
>>
>>Why don't you create an overloaded method?
>>
>>
>> Private overloads Sub AddToLog(ByVal tcString As String)
>> Log.Text += "Started: " + Date.Now + Chr(13) + Chr(10)
>> Log.Text += tcString + Chr(13) + Chr(10)
>> CursorLog()
>> End Sub
>> Private overloads Sub AddToLog(ByVal tcString As String, ByVal toObject As Object )
>> toObject.Text += "Started: " + Date.Now + Chr(13) + Chr(10)
>> toObject.Text += tcString + Chr(13) + Chr(10)
>> CursorLog()
>> End Sub
>>
>
>This seems interesting. How the overloads process works anyway?
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com