Add Data to AxMapControl without using Designer

255
0
10-15-2013 11:02 PM
Highlighted
New Contributor
Hello,
I try to create an AxMapControl without using Designer

  if (RuntimeManager.ActiveRuntime != null)
            {
                var c = new AxMapControl();
                ((ISupportInitialize)c).BeginInit();
                this.Controls.Add(c);
                ((ISupportInitialize)c).EndInit();

                string path = Path.GetDirectoryName(@"C:\temp\test.shp");
                string fileName = Path.GetFileName(@"C:\temp\test.shp");
                bool fileExists = File.Exists(Path.Combine(path, fileName));
                c.AddShapeFile(path, fileName);
                c.BringToFront();
            }
        }
and I getting an error on c.AddShapeFile(path, fileName); "The specific path is invalid"
But bool fileExists ist true and ActiveRuntime is not null!

What's wrong?
Reply
0 Kudos
0 Replies