-2

DateTimePicker1 = dateofbirth.Text

it says The Value of type 'String' cannot be converted to 'System.Windows.Forms.DateTimePicker'.

please help me how to convert the date from textbox to datetimepicker the format of date is yyyy/MM/dd. thank you in advance.

  • 1
    Doing `DateTimePicker1 = ...` will attempt to change the entire control. You want to modify its properties, not replace the entire DTP. – Visual Vincent Aug 26 '16 at 09:38

1 Answers1

0

You need to convert the text into a Date value and then assign it to the DateTimePicker's Value property.

DateTimePicker1.Value = Date.Parse(dateofbirth.Text)
JerryM
  • 910
  • 6
  • 9