需要在vb.net程序中增加日期的想法。 [英] Need idea on increasing the date in vb.net program.

查看:55
本文介绍了需要在vb.net程序中增加日期的想法。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在表单上有两个文本框。第一个是输入日期,例如2013年1月28日。第二个将通过将第一个文本框的日期值增加3年来获得结果。

我可以完成这项任务吗?如果是的话,请告诉我怎么样?我知道这个任务的代码应该用textchanged事件编写。但我不知道该怎么写。

I have 2 text boxes on the form. First one is to enter a date, for example 28/1/2013. and the second one will get the result by increasing the date value of first text box by 3 years.
Can I achieve this task? if so, please tell me how? I know the code for this task should be written in textchanged event. But don''t know what should I write.

推荐答案

Dim c As New DateTime(2013, 1, 28)

c = c.AddYears(3)


怎么样:DateAndTime.DateAdd [ ^ ]与 DateInterval.Year






为增量日期3年

你可以写这样的语法...



Hi,

for increment date by 3 years
you can write the syntax like this...

currentDate=currentDate.AddYears(3);





有关更多信息,您可以查看这个林ks

http://msdn.microsoft.com/en -us / library / system.datetime.addyears.aspx [ ^ ]


这篇关于需要在vb.net程序中增加日期的想法。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆