Methods are basically a controls public procedures and functions. If you want to make a procedure or function a method for your control (that the client can call), simply declare it as public. Private procedures and functions are not available to the client (and a good thing too!).
'// Public Refresh method
Public Sub Refresh()
UserControl.Refresh
txtMain.Refresh
End Sub
'// Private update method
Private Function Update(txtText As TextBox)
'// update text box
End Function
If you want to simply want to have a method that calls the method of another control on your user control (get that?), then you make your public function or sub have the same return type and parameters:
'// public Find method
Public Function Find(bstrString As String, Optional vStart, Optional vEnd, Optional
vOptions) As Long
'// call the RTB's find method, and return result
Find = rtfMain.Find (bstrString, vStart, vEnd, vOptions)
End Function
Comments