Click here to Skip to main content
15,900,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:

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


i know this code but how i implemented into my situation is not getting
Posted
Updated 3-Mar-16 3:10am
v2
Comments
Sinisa Hajnal 3-Mar-16 6:29am    
There are events TextBox Validating and Validated. There is event SelectedIndex (or Value) changed for the combobox. Either of these can trigger the calculation. Then you write the result in the return date textbox (in suitable format)
Atul Rokade 3-Mar-16 7:54am    
could you pls elaborate

1 solution

C#
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>]
 
Share this answer
 
Comments
Atul Rokade 3-Mar-16 13:36pm    
brother its a winform application

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900