PROC Refresh WITH This DO CASE CASE ISNULL(.xyz) or VARTYPE(.xyz) <> "L" * nothing to do CASE .xyz * set enabled state to the same value of forms editmode .Enabled = ThisForm.lEditMode OTHERWISE * set enabled state to the opposite value of forms editmode .Enabled = (NOT ThisForm.lEditMode) ENDCASE ENDWITH ENDPROCIdeally, since you say this is a custom button class, I would create an Assing method for this property in the button class. WHenever the property is assigned a value, return FALSE if the new value being assigned to it is not logical. Then you have no need to check to see if it is null or not logical.
>PROC Refresh >WITH This > DO CASE > CASE ISNULL(.xyz) > * nothing to do > CASE .xyz = .T. > * set enabled state to the same value of forms editmode > .Enabled = ThisForm.lEditMode > CASE .xyz = .F. > * set enabled state to the opposite value of forms editmode > .Enabled = (NOT ThisForm.lEditMode) >ENDWITH >ENDPROC >>