One way it to pass THISFORM as a parameter to the routine you are calling.
Another way is to put the calsulation in a calculation Object that you add to the form, so It can still reference THISFORM directly.
Is there a reason that you want to use a User Defined Function instead of an object?
[sitting in the Internat Cafe at "Conference to the Max", Arnhem]