回复 8楼 mywisdom88
简单写个示例,是否这意思:
** test.prg
CREATE CURSOR tt (bh C(10), xm C(20))
INSERT INTO tt VALUES ("101", "项目101")
INSERT INTO tt VALUES ("201", "项目201")
INSERT INTO tt VALUES ("301", "项目301")
INSERT INTO tt VALUES ("102", "项目102")
INSERT INTO tt VALUES ("202", "项目202")
INSERT INTO tt VALUES ("302", "项目302")
of = CREATEOBJECT("myform")
of.show(1)
DEFINE CLASS myform as Form
ADD OBJECT text4 as textbox WITH top=10,left=10,width=100
ADD OBJECT list1 as listbox WITH top=40,left=10,width=200,;
ColumnCount = 2,;
RowSourceType = 3
PROCEDURE Init
this._ListRequery()
ENDPROC
PROCEDURE _ListRequery()
IF !EMPTY(this.text4.value)
this.list1.RowSource = "SELECT bh,xm FROM tt WHERE ALLTRIM(thisform.text4.value)$bh INTO CURSOR tmp_list1"
**this.list1.RowSource = "SELECT bh,xm FROM tt WHERE bh=ALLTRIM(thisform.text4.value) INTO CURSOR tmp_list1"
ELSE
this.list1.RowSource = "SELECT bh,xm FROM tt INTO CURSOR tmp_list1"
ENDIF
*this.list1.Requery
ENDFUNC
PROCEDURE text4.InteractiveChange
thisform._ListRequery()
ENDPROC
ENDDEFINE