以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  根据天算日期  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=106386)

--  作者:yangwenghd
--  发布时间:2017/9/7 17:33:00
--  根据天算日期
在DateTimePicker1  输入日期,再在TextBox1输入天数,DateTimePicker2得到DateTimePicker1+天数的日期怎么写呀,感谢,感谢 
--  作者:堕落的后天
--  发布时间:2017/9/7 19:24:00
--  

语法:

AddDays(Value)

Value: 要加上的天数,可以是负数也可以是正数。

例如:

Dim d As Date = #2/28/2008#
Dim
d1 As Date = d.
AddDays(40) \'加上40天
Dim
d2
As Date = d.AddDays(-40) \'减去40天
Output.Show(
"40天后的日期:" & d1)
Output.Show(
"40天前的日期:"
& d2)


--  作者:有点甜
--  发布时间:2017/9/7 20:26:00
--  

参考

 

http://www.foxtable.com/webhelp/scr/0260.htm

 


--  作者:yangwenghd
--  发布时间:2017/9/14 22:16:00
--  
Dim d As Date = Controls("DateTimePicker1")
Dim d1 As Date = d.ComboBox1 \'加上40天
Dim Controls("DateTimePicker2") As Date = d.AddDays() \'减去40天
这个应该怎么写啊,感谢 感谢 
DateTimePicker2 = DateTimePicker1 +  ComboBox1


--  作者:有点甜
--  发布时间:2017/9/14 22:41:00
--  
Dim d As Date = e.form.Controls("DateTimePicker1").Value
Dim d1 As Date = d.AddDays(e.Form.Controls("ComboBox1").Text) \'加上40天
 

--  作者:yangwenghd
--  发布时间:2017/9/14 23:38:00
--  
DateTimePicker2怎么写在那里啊, 感谢 感谢 
--  作者:有点甜
--  发布时间:2017/9/15 8:56:00
--  
Dim d As Date = e.form.Controls("DateTimePicker1").Value
Dim d1 As Date = d.AddDays(e.Form.Controls("ComboBox1").Text) \'加上40天
 
e.form.Controls("DateTimePicker2").Value = d1
[此贴子已经被作者于2017/9/15 8:56:44编辑过]

--  作者:yangwenghd
--  发布时间:2017/9/15 23:07:00
--  
.NET Framework 版本:2.0.50727.8669
Foxtable 版本:2017.6.12.1
错误所在事件:窗口,计划表窗口,TextBox8,ValueChanged
详细错误信息:
从字符串“”到类型“Double”的转换无效。
输入字符串的格式不正确。

是控件是时间呀?为什么不对啊,感谢 感谢 

--  作者:有点蓝
--  发布时间:2017/9/15 23:21:00
--  
Dim d1 As Date = d.AddDays(val(e.Form.Controls("ComboBox1").Text) )