新增的时候,日期是空的Dim dtp As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker1")
If dtp.Value IsNot Nothing Then
Dim filter As String = "星期 = " & dtp.Value.DayOfWeek
Tables("课程表").Filter = filter
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv.BuildTree("课程表","学校名称|班级|星期|节次", filter, "班级,节次")
trv.StopRedraw '停止绘制目录树
For Each nd As WinForm.TreeNode In trv.AllNodes '遍历所有节点
If nd.Level = 3 Then '如果是二级节点
nd.Text = nd.text & "," & nd.DataRow("科目") & "," & nd.DataRow("任课教师")
End If
If nd.level = 2 Then
nd.Text = "星期" & nd.DataRow("星期")
End If
If nd.level = 1 Then
nd.text = nd.DataRow("班级").Substring(3,2) & "级" & nd.DataRow("班级").substring(5,2) & "班" & nd.DataRow("班级").substring(7,1) & "期"
End If
Next
trv.ResumeRedraw
End If