I am writing this code the text Change event but it is showing the error that is string is not valid.
DateTime ts=Convert.ToDateTime(Joiningdate.Text);
DateTime dt1=ts.AddMonths(6);
txtcd.Text = dt1.ToShortDateString();
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The DataTime format does not match the format you need to convert string to DateTime object. You can use DateTime.ParseExact() to give you format you date you have.
Assuming you have format dd/MM/YY for the textbox