以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]日期输入控件问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=18007)

--  作者:mositu
--  发布时间:2012/3/30 15:07:00
--  [求助]日期输入控件问题

Dim d1 As Date = DateTimePicker1.value
Dim d2 As Date = DateTimePicker2.value
Dim m As Integer = (d2.year - d1.year) * 12 + (d2.month - d1.month)
textbox9.text = m

有什么问题吗


--  作者:狐狸爸爸
--  发布时间:2012/3/30 15:15: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)
e.Form.Controls("TextBox9").Value = m

 

 

[此贴子已经被作者于2012-3-30 15:16:11编辑过]

--  作者:唐尸三摆手
--  发布时间:2012/3/30 15:20:00
--  

基本常识错误

dim frm as winform.form = e.form

Dim d1 As Date = frm.controls("DateTimePicker1").value
Dim d2 As Date = frm.controls("DateTimePicker2").value

Dim m As Integer = (d2.year - d1.year) * 12 + (d2.month - d1.month)
frm.controls("textbox9").text = m

 

建议先读三遍帮助文件,心急吃不得热豆腐