表单有标签2个,文本框2个,命令按钮4个,表格1个
(1)FORM1.INIT()
CLOSE ALL
IF FILE([职工.DBF])
USE 职工.DBF
ELSE
CREATE TABLE 职工 (工号 C(4),姓名 C(8),性别 C(2),出生日期 D)
ENDIF
THISFORM.GRID1.RECORDSOURCETYPE=1
THISFORM.GRID1.COLUMNCOUNT=-1
THISFORM.GRID1.RECORDSOURCE="职工"
THISFORM.TEXT1.INPUTMASK="XXXX"
THISFORM.TEXT2.INPUTMASK="XXXXXXXX"
PUBLIC cText1,cText2
THISFORM.BORDERSTYLE=2
(2)增加COMMAND1.CLICK()
APPEND BLANK
THISFORM.REFRESH
(3)删除COMMAND2.CLICK()
DELETE
THISFORM.GRID1.RECORDSOURCE=NULL
PACK
THISFORM.GRID1.RECORDSOURCE="职工"
THISFORM.REFRESH
(4)查询COMMAND3.CLICK()
cText1=ALLTRIM(THISFORM.TEXT1.VALUE)
cText2=ALLTRIM(THISFORM.TEXT2.VALUE)
DO CASE
CASE EMPTY(cText1) AND EMPTY(cText2)
SET FILTER TO
CASE !EMPTY(cText1) AND EMPTY(cText2)
SET FILTER TO cText1$工号
CASE EMPTY(cText1) AND !EMPTY(cText2)
SET FILTER TO cText2$姓名
CASE !EMPTY(cText1) AND !EMPTY(cText2)
SET FILTER TO cText1$工号 AND cText2$姓名
ENDCASE
THISFORM.REFRESH
(5)结束COMMAND4.CLICK()
THISFORM.RELEASE
(1)FORM1.INIT()
CLOSE ALL
IF FILE([职工.DBF])
USE 职工.DBF
ELSE
CREATE TABLE 职工 (工号 C(4),姓名 C(8),性别 C(2),出生日期 D)
ENDIF
THISFORM.GRID1.RECORDSOURCETYPE=1
THISFORM.GRID1.COLUMNCOUNT=-1
THISFORM.GRID1.RECORDSOURCE="职工"
THISFORM.TEXT1.INPUTMASK="XXXX"
THISFORM.TEXT2.INPUTMASK="XXXXXXXX"
PUBLIC cText1,cText2
THISFORM.BORDERSTYLE=2
(2)增加COMMAND1.CLICK()
APPEND BLANK
THISFORM.REFRESH
(3)删除COMMAND2.CLICK()
DELETE
THISFORM.GRID1.RECORDSOURCE=NULL
PACK
THISFORM.GRID1.RECORDSOURCE="职工"
THISFORM.REFRESH
(4)查询COMMAND3.CLICK()
cText1=ALLTRIM(THISFORM.TEXT1.VALUE)
cText2=ALLTRIM(THISFORM.TEXT2.VALUE)
DO CASE
CASE EMPTY(cText1) AND EMPTY(cText2)
SET FILTER TO
CASE !EMPTY(cText1) AND EMPTY(cText2)
SET FILTER TO cText1$工号
CASE EMPTY(cText1) AND !EMPTY(cText2)
SET FILTER TO cText2$姓名
CASE !EMPTY(cText1) AND !EMPTY(cText2)
SET FILTER TO cText1$工号 AND cText2$姓名
ENDCASE
THISFORM.REFRESH
(5)结束COMMAND4.CLICK()
THISFORM.RELEASE
感言:学以致用。 博客:http://www./blog/user14/65009/index.shtml email:Tiger5392@