Click here to Skip to main content
15,909,030 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have created

* 1 Datetimepicker (from date)
* 1 Comboxbox (How many days)
* 1 Textbox (Here it should display . Fromdate + How many days u select)

In the Combobox u select the from date in the combobox i have days 5,10,15,30 .
In the textbox i want to display the date.

So an example if i select 2014-02-22 in the DateTimePicker and in the Combox 5 Days i want it to display 2014-02-27 in the textbox.

Any Suggestions?

I solved it like this
C#
DateTime dt = Convert.ToDateTime(dateTimePickerFron.Value.ToShortDateString());
            dt = dt.AddDays(Convert.ToInt32(comboBoxdagar.SelectedItem));
            textBoxEndDate.Text = dt.ToString(CultureInfo.InvariantCulture);


But right now it displays like this

03/17/2014 00:00:00

I want to remove the time and only display the date.
But i want to have the date like this displayed
2013-03-14
Posted
Updated 21-Feb-14 21:51pm
v4

DateTime.AddDays[^]?

When either the DateTimePicker or the ComboBox change value, grab both values and call AddDays to get the new date.
 
Share this answer
 
 
Share this answer
 

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