Click here to Skip to main content
15,884,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
for example...if i pick 28/08/2014.....the textboxes should give me value 29/08/2014 , 30/08/2104 , 31/08/2014 and 01/09/2014
Posted
Updated 29-Aug-14 19:57pm
v2
Comments
[no name] 29-Aug-14 9:27am    
Okay.... and is there a question or a description of some sort of a problem forthcoming? How is this a problem? What have you done to solve your problem? What problem did you encounter with your code?

Here's all you need. Be warned, it's scary.

C#
public string AddDay(string fromTextBox)
{
    var baseDate = DateTime.Parse(fromTextBox);
    return baseDate.AddDays(1).ToString(CultureInfo.InvariantCulture);
}
 
Share this answer
 
You can use the ValueChanged event of the DateTimePicker.

C#
private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{
    DateTime date = dateTimePicker1.Value;
    textbox1.Text = date.AddDays(1).ToShortDateString();
    textbox2.Text = date.AddDays(2).ToShortDateString();
    textbox3.Text = date.AddDays(3).ToShortDateString();
    textbox4.Text = date.AddDays(4).ToShortDateString();
}
 
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