Sunday, November 05, 2006

convert sting value to the value of datetimepicker

generally the format should be everything except the AM part.

DateTime result = DateTime.Now;

if (DateTime.TryParse(this.label1.Text, out result))

{

this.dateTimePicker.Value = result;

}

We can also use DateTime.TryParseExact:
http://msdn2.microsoft.com/en-us/library/h9b85w22(VS.80).aspx

No comments: