vfp 多个控件中的代码完全相同,如何引用?
text1程序改变事件中代码:CLOSE ALL
USE spxx
LOCATE FOR ALLTRIM(sp)==ALLTRIM(this.value)
IF FOUND()
DIMENSION x(1)
SELECT dj FROM spxx WHERE ALLTRIM(sp)==ALLTRIM(this.value) INTO ARRAY x
thisform.text13.Value=x(1)
ELSE
thisform.text13.Value=0
ENDIF
CLOSE ALL
text2程序改变事件中代码:
CLOSE ALL
USE spxx
LOCATE FOR ALLTRIM(sp)==ALLTRIM(this.value)
IF FOUND()
DIMENSION x(1)
SELECT dj FROM spxx WHERE ALLTRIM(sp)==ALLTRIM(this.value) INTO ARRAY x
thisform.text13.Value=x(1)
ELSE
thisform.text13.Value=0
ENDIF
CLOSE ALL
问:如何省去text2中的代码,而直接引用text1中的代码呢?(考虑过自定义方法,但它好像是针对表单的,这里行吗?)