I'm working on a project to develop a UWP app.
I'm getting the above mentioned error when I click a button intended to navigate to another frame.
Here's the code of the first frame:
private void Search_Click(object sender, RoutedEventArgs e)
{
Submit();
}
void Submit()
{
DateTime? pickupdate;
pickupdate = PickupDate.Date.DateTime;
DateTime? retdate;
retdate = ReturnDate.Date.DateTime;
Reservation res = new Reservation(pickupdate.Value.ToString("dd-MM-yyyy"), retdate.Value.ToString("dd-MM-yyyy"));
Frame.Navigate(typeof(Reservation));
}
And the code for the second frame:
public Reservation(string pickup, string _return)
{
InitializeComponent();
PickupDateDisplay.Text = pickup;
ReturnDateDisplay.Text = _return;
}
UPDATE:
Ok so I overloaded the Reservation() constructor and now the code for the second frame looks like this:
public Reservation()
{
InitializeComponent();
}
public Reservation(string pickupdate,string retdate)
{
InitializeComponent();
PickupDateDisplay.Text = pickupdate;
ReturnDateDisplay.Text = retdate;
}
Now I don't get any errors on runtime but the PickupDateDisplay.Text and ReturnDateDisplay.Text does not change