计算TextBox的日期 [英] Calculate dates to TextBox

查看:85
本文介绍了计算TextBox的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi
我使用C#和SQL Server 2005开发了一个Win Applicaion。在一个表单中,我使用了三个组合框来表示DOBddBox,mmBox,yyyyBox和一个textBox1。我的查询是当用户将在ddBox,mmBox,yyyyBox中输入他的DOB时,他的退休日期应该通过在他的DOB中添加60年来自动显示在textBox1中。

例如: - DOB + 60年=退休日期

我没有写过任何代码。不知道。请有人帮助我。谢谢

Hi I am develeoping a Win Applicaion by using C# and SQL Server 2005. In a form I used three comboBoxes for DOB "ddBox, mmBox, yyyyBox" and a textBox1. My query is when the user will enter his DOB in "ddBox, mmBox, yyyyBox" his Date of Retirement should be automatically shown in textBox1 by adding 60 years with his DOB.
As for example:- " DOB + 60 years = Date of Retirement "
I don''t have written any code fot this. Don''t have idea. Please someone help me.Thanks

推荐答案

使用这个 [ ^ ]


我不明白为什么你选择三个组合框来接受出生日期,而是使用DateTimePicker来接受出生日期并使用它的Value [ ^ ]属性接受用户选择的日期。



使用将您的年份添加到所选日期DateTime.AddYears [ ^ ]。
I dont understand why you choose three combobox to accept the date of birth, instead use DateTimePicker to accept the date of birth and use its Value [^]property to accept the user selected date.

And add your year to the selected date using DateTime.AddYears[^].


这篇关于计算TextBox的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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