Thursday, October 26, 2006

VB6 Example

Private Sub SetFormCaption(ByVal strcaption As String)
'**********************************************************************************************************
' PURPOSE:
' Sets the Child Form's caption property when this control is loaded.
'**********************************************************************************************************
On Error Resume Next

UserControl.Parent.Caption = strcaption

End Sub


I am working on an application currently, and one of the functions is the function above. With my great and wonderful refactoring skills I have been able to cut out 6 lines from this function. Please see the wonderfully updated version below.

Private Sub SetFormCaption(ByVal strcaption As String)
On Error Resume Next
UserControl.Parent.Caption = strcaption
End Sub

No comments: