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

问题描述

我制作了一个特殊的简历程序,但遇到了问题
在我的程序中.我使用了一个显示生日的masktaskbok,但是用户插入了程序中接受的无效生日.但我希望出生日期有效,因此请提供此问题的代码.
谢谢........

I made a particular program of resume, but I have a problem
in my program. I take a masktaskbok of showing date of birth but user inserts date of birth that is invalid that is accepted in the program. But I want date of birth to be valid, so please give code of this problem.
Thank you........

推荐答案



for(int i =1;i<=31;i++)
{
cbodate.Items.Add(i);
}



然后,您可以使用if else if condition语句来检查生日日期值,例如,如果用户使用此条件语句输入2月31日,则可以施加限制,如果用户输入了错误的日期,则可能会显示一个消息框,或者错误的月份,其中包含错误的日期,例如4月31日.

现在,如果它是一个ASP.NET应用程序,那么我的朋友我建议您使用相同的技巧或使用框架中可用的任何验证ctrl.

这只是做您想做的另一种方法,但是如果您坚持使用maskedtxtbx,那么我对此没有任何建议.....或者您也可以使用DATETIMEPICKER并相应地设置验证...

谢谢&问候,
基数:-\​​

如果对我的回答有所帮助,请对我的回答进行评分.谢谢.



And then you may use if else if condition statement to check in the date of birth value, say you can impose a restriction if the user enters 31st of Feb using this conditional statement you may show a messagebox if the user enters a wrong date, or wrong month containing a wrong date say 31st april.

Now if it''s an ASP.NET application, then my friend I may suggest you to use the same trick or use any validating ctrls available in the framework.

This is just another method of doing what you want to do but if you insist on using maskedtxtbx, then I have no suggestions on that..... or you can also use DATETIMEPICKER and set validations accordingly...

Thanks & regards,
Radix :-\

Do rate my answer if you find it helpful to some extent. Thank you.


这篇关于无效的出生日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-26 06:03