Local oCom as object oCom = createobject('myfirstcom.testclass') oCom.SetKeyboard(lcYourCode)You can to create a property in the Form instead the variable "oCom".
>>define class testclass as cuistom olepublic >> name="testclass" >> >> function testmethod >> return "it works?" >> endfunc >> >> PROCEDURE SetKeyboard(lcKeyboardcode as String) >> IF VARTYPE(lcKeyboardcode)<>'C' >> RETURN >> ENDIF >> IF EMPTY(lcKeyboardcode) >> RETURN >> ENDIF >> LOCAL pwSzklid >> pwSzklid = SPACE(8) >> DECLARE INTEGER GetKeyboardLayoutName IN user32.DLL STRING @ >> geTkeyboardlayoutname(@pwSzklid) >> DECLARE INTEGER ActivateKeyboardLayout IN user32.DLL INTEGER, INTEGER >> IF ATC(lcKeyboardcode, pwSzklid)=0 >> acTivatekeyboardlayout(1,0) >> ENDIF >> RETURN >> ENDPROC >>enddefine >> >> >>*- Test >>oCOM = createobject('myfirstcom.testclass') >>? oCom.testmethod() >>? oCom.SetKeyboard(lcYourCode) >>>>Good luck!