Final Date will populate in tb.Text
I have textbox poplulates a number so that number 3
My thought would be
|
But it doesn't add 3 days to todays date
Any thoughts?
|
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kirtan PatelPosted Mar 1, 2010, 7:38 PM
just replace last line of my above code to
textBox3.Text = date2.Add(ts).ToString("MMMM/dd/yyyy");
RIck MuellerPosted Mar 1, 2010, 8:33 PM
It worked
Thanks
RIck MuellerPosted Mar 1, 2010, 8:26 PM
I tried that, Didn't work
RIck MuellerPosted Mar 1, 2010, 7:32 PM
It works, but I'm having trouble formatting the date to ("MMMM/dd/yyyy")
Regards,
Kirtan PatelPosted Mar 1, 2010, 6:00 PM
private void button1_Click(object sender, EventArgs e)
{
DateTime date1 = DateTime.Parse(textBox1.Text);
DateTime date2 = DateTime.Parse(textBox2.Text);
TimeSpan ts = date2.Subtract(date1);
textBox3.Text = date2.Add(ts).ToShortDateString();
}
Bryian TanPosted Mar 1, 2010, 5:21 PM
Try something like DateTime.Now.AddDays(3).ToShortDateString()