if !(pemstatus(THIS,tcfieldname,5)) and ; THIS.AddProperty(tcfieldname, tufieldvalue) thenThe table I tested with had a NAME field. When the AddProperty() executed, the object threw an error.
define class sesProperty as Session olepublic procedure GetFields use foxuser.dbf local lxx, lnfldcnt, loretval local array laflds[1] loretval = createobject('cusReturn') for lxx = 1 to afields(laflds) loretval.AddFieldProps(field(lxx),evaluate(field(lxx))) endfor use in foxuser return loretval endproc enddefine define class cusReturn as custom dimension apropnames[1] apropnames[1] = (space(0)) npropnum = 0 procedure AddFieldProps lparameter tcfieldname, tufieldvalue if !(pemstatus(THIS,tcfieldname,5)) and ; THIS.AddProperty(tcfieldname, tufieldvalue) then if empty(THIS.apropnames[1]) then THIS.apropnames[1] = tcfieldname else local narrlen narrlen = THIS.npropnum+1 dimension THIS.apropnames[narrlen] THIS.apropnames[narrlen] = tcfieldname endif endif endproc procedure npropnum_access return alen(THIS.apropnames,1) endproc enddefineThis was compiled into a DLL using the following commands:
build project proptest from proptest build dll proptest from proptestAnd here is my test program:
clear local lox, loy, lcproperty, lxx lox = createobject('proptest.sesproperty') loy = lox.getfields() for lxx = 1 to loy.nPropnum lcproperty = 'loy.'+loy.apropnames[lxx] ? evaluate(lcproperty) endforRegards.