May 26, 2013 at 5:57 AM
Edited May 26, 2013 at 6:01 AM
I'm a beginner at .NET framework and need some help regarding an exception I'm getting when running Example 1 (compilation is fine):
A first chance exception of type 'System.IO.FileNotFoundException' occurred in SharpMap.dll
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in SharpMap.dll
Additional information: The specified path does not lead to a file
The program ' SharpMap_Forms.vshost.exe: Managed (v4.0.30319)' has exited with code 0 (0x0)
public partial class Form1 : Form
SharpMap.Layers.VectorLayer vlay = new SharpMap.Layers.VectorLayer("States");
vlay.DataSource = new SharpMap.Data.Providers.ShapeFile("path_to_data\\states_ugl.shp", true); <---
Before this I was getting an exception of type 'System.TypeInitializationException' in SHarpMap.UI.dll but I resolved it by looking at this thread:
I'm using VS Express 2012 and have made sure I'm using the full .NET 4.0 version.
Any help would be much appreciated.
May 27, 2013 at 7:08 AM
vlay.DataSource = new SharpMap.Data.Providers.ShapeFile("path_to_data\\states_ugl.shp", true);
You probably need to change
to some real value. Leaving it as is, you need to have the whole shapefile set (shp, shx, dbf) in the folder path_to_data relative to your compiled exe.