本文介绍了如何验证masktextbox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



实际上我有一个应用程序,其中有三列1. start_amout占用日期2)有效期3)amount_return_date



在有效期字段iam使用1到12个月的组合框,现在我想如果用户选择start_amount_taking_date假设今天是03/03/2015并且选择有效期2个月那么自动,amount_return_date应该显示2个月的日期那是03/05/2015如果用户选择12个月所以amount_return_date应该显示03/03/2017实际上坦率地说我不知道​​该怎么办,因为(1)和(3)都是掩码文本框,有效性是组合框



所以请任何人都可以帮助我,请



我尝试了什么:



hi all,

actually i have one application where having three column 1. start_amout taking date 2)validity 3) amount_return_date

in validity field iam using combobox having 1 to 12 months, now i want if user select start_amount_taking_date suppose today that is 03/03/2015 and selected validity 2 months so automatically, amount_return_date should display 2 months date that is 03/05/2015 if user selected 12 months so amount_return_date should be display 03/03/2017 actually frankly speaking iam not getting how should i do because both (1) and (3) are masktextbox and validity is combobox

so please anyone can help me ,please

What I have tried:

if (date.Day != DateTime.DaysInMonth(date.Year, date.Month))
      return date.AddMonths(1);
   else 
      return date.AddDays(1).AddMonths(1).AddDays(-1);





i知道这段代码,但我如何实现我的情况是没有得到



i know this code but how i implemented into my situation is not getting

推荐答案

You can use javascript to set the value and to do that follow-
<a href="https://jsfiddle.net/taditdash/8FHwL/">[Demo] Add Days to a Date in JavaScript - JSFiddle</a>[<a href="https://jsfiddle.net/taditdash/8FHwL/" target="_blank" title="New Window">^</a>]


这篇关于如何验证masktextbox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 14:30