Hi there,

I'm trying to make a combined Object and Control Center function, but I'm getting error message saying:
"object doesn't support property or method"

I'm calling my function like this at run-time:

Code:
Call CenterObject(Me, Picture1)
Code:
Public Function CenterObject(objPARENT As Object, objCTL As Control)
 
 With objPARENT
  If TypeOf objPARENT Is Form Then
   .objCTL.Left = (.ScaleWidth / 2) - (.objCTL.Width / 2)
   .objCTL.Top = (.ScaleHeight / 2) - (.objCTL.Height / 2)
  Else
   .objCTL.Left = (.Width / 2) - (.objCTL.Width / 2)
   .objCTL.Top = (.Height / 2) - (.objCTL.Height / 2)
  End If
 End With
 
End Function
Thank you for your support!

Kind regards,
Viktor