Calculating Date
-
Hello, I am looking out for a logic to calculate the date according to the no. entered in the textbox. For e.g. as the form gets loaded in runtime it displays the current date in the date control, and there is one text box in which numeric value 5 is specified and the third part is their is one more date control on the same form which will add 5 days to the current date and display. For e.g. In first date control current date is displaying as 29/08/2006 In the textbox below numeric value 5 is specified by default. In second date control which is just below the textbox should display 03/09/2006 it has jumped to next month even does any body knows how it can be done, waiting for kind and quick response.
Nikhil Bandekar Mumbai, India
-
Hello, I am looking out for a logic to calculate the date according to the no. entered in the textbox. For e.g. as the form gets loaded in runtime it displays the current date in the date control, and there is one text box in which numeric value 5 is specified and the third part is their is one more date control on the same form which will add 5 days to the current date and display. For e.g. In first date control current date is displaying as 29/08/2006 In the textbox below numeric value 5 is specified by default. In second date control which is just below the textbox should display 03/09/2006 it has jumped to next month even does any body knows how it can be done, waiting for kind and quick response.
Nikhil Bandekar Mumbai, India
-
Use the AddDays method of the DateTime class to add a number of days to a date: DateControl2.DateProperty = DateControl1.DateProperty.AddDays(Int32.Parse(TextBox.Text))
--- b { font-weight: normal; }
Thank you very much it works but i changed the code little bit by typing datecontrol.value instead of date property and it works fine Thanks a lot.
Nikhil Bandekar Mumbai, India