1
votes

I have a picker on my Main form. I need to go to another form and when I go back to Main I want the picker to show the same value as before. In order to do that, I wanted to save the value of the picker into an static Date variable, but when I run the code I get a "Integer cannot be cast to Date" exception. I am attaching a picture of a try I did assigning the value to an auxiliar Date variable. I get the same error:

enter image description here

1
Please add the code where you set the value to the picker itself. Also provide the stack message from the console in questions such as this. - Shai Almog

1 Answers

0
votes

Make sure you invoked setDate on the picker and not some other method such as setTime that is meant for a time picker.

Notice that date/time & date-time pickers use different data types.