michaelforst

Add Data to AxMapControl without using Designer

Discussion created by michaelforst on Oct 15, 2013
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?

Outcomes