学会调试
Dim d1 As Date = Date.Today
msgbox("d1=" & d1)
Dim d2 As Date = e.form.controls("开始日期").Value
msgbox("d2=" & d2)
Dim d3 As Integer = e.form.controls("项目周期").Value
msgbox("d3=" & d3)
e.form.controls("结束日期").Value = d1.AddDays(d3)
msgbox("结束日期=" & e.form.controls("结束日期").Value)
msgbox("d4=" & d4)
Dim t As TimeSpan = d4 - d1
e.form.controls("剩余天数").text = t.Days
msgbox("剩余天数=" & t.Days)
msgbox("已过天数=" & d3 - t.Days)
e.Form.Controls("已过天数").text = d3 - t.Days