It is hard to say about particular causes of this problem without your solution, but using just a code snippet you sent. But it looks the properties of shp and dbf files in your project are incorrect. You should be sure that your shape-file is copied to the output directory:
1. Select the cb_2013_us_state_500k.shp and dbf in the solution explorer.
2. Go to the "Properties" window.
3. Check that "Build Action" is set to "None".
4. Check that "Copy to Output Directory" is set to "Copy always" or to "Copy if newer".
Also you can check an error which can occur during loading of shape-file. You can check the PreviewReadShapesCompletedEventArgs.Error
property in your PreviewReadCompleted
event handler. It returns the exception when an error occurs.
The sample code is below.
sender, PreviewReadShapesCompletedEventArgs eventArgs)
// process items
// eventArgs.Items contains the list of objects which are created by MapShapeReader
I hope this information will be helpful.
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos
and start improving your app based on facts, not hunches.