Datacolchanged 事件所有代码是这样的:
If e.DataCol.Name = "日期" Then
If e.NewValue = Nothing Then
e.DataRow("星期") = Nothing
Else
e.DataRow("星期") = Format(e.DataRow("日期"), "dddd")
e.DataTable.AddNew
End If
End If
If e.DataCol.Name = "时间" Then
If e.NewValue = Nothing Then
e.DataRow("排序时间") = Nothing
Else
e.DataRow("排序时间") = e.DataRow("时间").Substring(3)
End If
End If
If e.DataCol.Name = "日期" Then
If e.NewValue = Nothing Then
e.DataRow("星期") = Nothing
Else
e.DataRow("星期") = Format(e.DataRow("日期"), "dddd")
End If
Else If (e.DataCol.Name = "星期" OrElse e.DataCol.Name = "新老客户") AndAlso e.DataRow("新老客户")="老客户" Then
Dim i As Integer = 0
Dim dr As DataRow
SystemReady = False
For Each fdr As DataRow In DataTables("客户数据").Select("固定时间 = '" & e.DataRow("星期") & "'")
If i = 0 Then
dr = e.DataRow
Else
dr = e.DataTable.AddNew
End If
dr("日期") = e.DataRow("日期")
dr("星期") = e.DataRow("星期")
dr("新老客户") = e.DataRow("新老客户")
dr("客户信息") = fdr("综合信息")
dr("客户要求") = fdr("客户要求")
dr("时间") = fdr("时间")
i += 1
Next
e.DataTable.DeleteFor("日期 is Null")
e.DataTable.AddNew
SystemReady = True
End If