以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]自定义函数计算月差  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=18223)

--  作者:mositu
--  发布时间:2012/4/6 17:16:00
--  [求助]自定义函数计算月差

Dim d1 As Date = e.Form.Controls("DateTimePicker1").value
Dim d2 As Date = e.Form.Controls("DateTimePicker2").value
Dim m As Integer = (d2.year - d1.year) * 12 + (d2.month - d1.month)

怎么自定义函数


--  作者:狐狸爸爸
--  发布时间:2012/4/6 17:33:00
--  
函数:
 
Dim d1 As Date = args(0)
Dim d2 As Date = args(1)
return  (d2.year - d1.year) * 12 + (d2.month - d1.month)
 
调用:
 
Dim d1 As Date = e.Form.Controls("DateTimePicker1").value
Dim d2 As Date = e.Form.Controls("DateTimePicker2").value
Functions.Execute("函数名",d1,d2)