Hi,
As Glenn said just add following in the click event of the Button and change the myClasslibName, myClassName & desciption to what you want.
thisform.saveasclass("myClasslibName","myClassName","Some description if you need it")
Regards N Mc Donald