> Private Sub AddToLog(ByVal tcString As String, Optional ByVal toObject As Object = "Log") > toObject.Text = toObject.Text + "Started: " + Date.Now + Chr(13) + Chr(10) > toObject.Text = toObject.Text + tcString + Chr(13) + Chr(10) > CursorLog() > End Sub>However, this generates development time error. This is normal as toObject is not a control on the form. How can I achieve that?
Public Class Tests Public Sub PassControlRef(ByVal controlRef As Object) Dim TextProp As System.Reflection.PropertyInfo TextProp = controlRef.GetType.GetProperty("Text") If Not TextProp Is Nothing Then TextProp.SetValue( _ controlRef, _ "Message: Passing this control as an object reference worked.", _ Nothing) End If End Sub End Class