下列Form1.Init事件代码有点问题,点击教师任课表与班级课程表,TreeView控件切换不过来(如图),请高手指教,谢谢!
DO CASE
CASE thisform.optiongroup1.value=1
thisform.optiongroup1.option1.Click()
thisform.olecontrol1.LINESTYLE= 1 && tvwRootLines
thisform.olecontrol1.STYLE=7
thisform.olecontrol1.Nodes.clear
SELECT distinct 部门,bmdh FROM jsmd20190101 into CURSOR temp ORDER BY bmdh
scan
thisform.olecontrol1.Nodes.Add(,,'部门'+ALLTRIM(部门),部门)
SELECT DISTINCT 姓名 FROM jsmd20190101 WHERE jsmd20190101.部门=TEMP.部门 INTO CURSOR TEMP1
SELECT TEMP1
SCAN
THISFORM.OLECONTROL1.Nodes.Add('部门'+ALLTRIM(temp.部门),4,'XM'+ALLTRIM(temp.部门)+ALLTRIM(姓名),姓名)
ENDSCAN
USE IN TEMP1
SELECT TEMP
ENDSCAN
USE IN TEMP
THISFORM.OLECONTROL1.REFRESH
CASE thisform.optiongroup1.value=2
thisform.optiongroup1.option2.Click()
thisform.olecontrol1.LINESTYLE=1
THISform.olecontrol1.STYLE=7
thisform.olecontrol1.Nodes.clear
SELECT distinct NJ FROM kb20190101 into CURSOR temp
INDEX ON NJ TAG NJSY
SET ORDER TO NJSY
scan
thisform.olecontrol1.Nodes.Add(,,'年级'+ALLTRIM(NJ),NJ)
SELECT DISTINCT BJ FROM KB20190101 WHERE KB20190101.NJ=TEMP.NJ INTO CURSOR TEMP1
SELECT TEMP1
SCAN
THISFORM.OLECONTROL1.Nodes.Add('年级'+ALLTRIM(temp.NJ),4,'班级'+ALLTRIM(temp.NJ)+ALLTRIM(BJ),BJ)
ENDSCAN
USE IN TEMP1
SELECT TEMP
ENDSCAN
USE IN TEMP
THISFORM.OLECONTROL1.REFRESH
ENDCASE
[此贴子已经被作者于2022-5-4 08:12编辑过]