lparameters toParentForm local loParentForm loParentForm = iif(vartype(toParentForm) = 'O' and pemstatus(toParentForm, 'imgABC', 5) and pemstatus(toParentForm, 'imgXYZ', 5), toParentForm, .null.)then when you want use them:
* note that from now on I do not use toParentForm any longer but loParentForm instead if not isnull(loParentForm) loParentForm.imgABC.Visible = .t. loParentForm.imgXYZ.Visible = .t. endifNow, it might be better if instead of using the long list of pemstatus you might need (for example it seems you have lot of images, and even then pemstatus might not be enough, as imgXYZ might be defined but is not an object or is an object of a class that do not have the interface you expect) you could use the name of the form and then check that are is one of the allowed forms, or better, you only perform the calls if the class of the form is a determined one.