Dim d1 As Date = Date.Today Dim d2 As Date = e.form.controls("DateTimePicker2").Value Dim nl As integer = d1.Year-d2.Year e.form.controls("TextBox3").Value = nl
同理,在表属性的BeforeLockDataRow里加入如下代码: Dim d1 As Date = "2007-12-31" Dim d2 As Date = e.dataRow("第二列") Dim nl As integer = d1.Year-d2.Year e.dataRow("到2007年底的年龄") = nl