JOHN JOHNNNY

JOHN JOHNNNY

  • NA
  • 190
  • 140.1k

An exception of type 'System.Reflection.TargetInvocationExce

Feb 4 2015 9:42 AM
Hi
 
I am trying to use date picker in my app but when i run the code in the emulator it shows the following error
"An exception of type 'System.Reflection.TargetInvocationException' occurred in Microsoft.Phone.ni.dll and wasn't handled before a managed/native boundary
The program '[2184] TaskHost.exe' has exited with code -1 (0xffffffff)."
 
This is my code below
public partial class MainPage : PhoneApplicationPage
{
Appointments appointments = new Appointments();

// Constructor
public MainPage()
{
InitializeComponent();
 
appointments.SearchCompleted += new EventHandler(appointments_SearchCompleted);
SearchCalendar();
 
// Sample code to localize the ApplicationBar
//BuildLocalizedApplicationBar();
}
 
private void SearchCalendar()
{
appointments.SearchAsync(DateBox.Value.Value, DateBox.Value.Value.AddDays(1), null);
}
 
private void DateBox_ValueChanged(object sender, DateTimeValueChangedEventArgs e)
{
SearchCalendar();
}
 
void appointments_SearchCompleted(object sender, AppointmentsSearchEventArgs e)
{
if (e.Results.Count() == 0)
{
MessageText.Text = "no events for the selected day";
}
else
{
MessageText.Text = e.Results.Count() + " events found";
DateList.ItemsSource = e.Results;
}
}
Kindly help

Answers (1)