ReferACTXProp



Public YourProperty As String
Public Sub ShowMainForm()
'passes control reference to form

Load frmMain
Call frmMain.ControlRef(Me)
frmMain.Show
End Sub

'4. This will create one method (ShowMainForm)

' and one property (YourProperty) for your

' user control.

'5. Add the following code to the the form (frmMain):

' Holds reference to usercontrol Private cCtl As ctlTest

' Takes control reference passed and stores in in local

' variable

Public Sub ControlRef(cC As ctlTest)
Set cCtl = cC
End Sub

Private Sub cmdMain_Click()
cCtl.YourProperty = _
"Changing Property Value From Another Form!"
End Sub

'6. Please note that any changes to properties of the user

' control or calls to methods or proceedures must occur

' on or after the Form_Activate event.

'7. From whatever project you add your new user control to,

' you can now use the ShowMainForm method to open the

' main form and pass the control reference, and manipulate

' the properties of the control.


(referactxprop.html)- by Paolo Puglisi - Modifica del 25/3/2019