Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

This code used to work...

if (File.Exists(@"C:\Roads.shp"))
{
  mapControl.AddShapeFile(@"C:\", "Roads.shp");
}

I have Roads.shp on the C:\ drive

I also have Roads dot {sbn, sbx, shp.gcd, shp.xml, shx} in the same place, c:\

The program throws an "The specified filename is invalid" exception with no Inner Exception. Could it be related to installing ArcEngine 10 SP1? That's the only thing I can think of... Really appreciate any ideas, thanks in advance.

Using ArcEngine 10 with SP1 with C# VS2010


I guess I was making a Noob mistake it looks like I forgot to copy Roads.dbf to the target directory.

Too bad the error message isn't slightly more helpful.

share|improve this question
1  
Did the contents of C:\ change? Are you sure your shapefile has all it's constituent files? –  Regan Sarwas Dec 15 '10 at 19:40
2  
I agree. many items could have better error messages –  Brad Nesom Dec 15 '10 at 20:49
3  
I'm so glad they have error messages at all: for years all one ever got--if the system didn't crash outright--was an assertion statement (which, because it happened so often, served as a constant reminder that we were all (paying) alpha testers of the software). –  whuber Dec 15 '10 at 22:22
    
it's okay to answer the question yourself, and accept it as answered. Embedding the answer in the question will keep it lingering in the unanswered pool forever. –  matt wilkie Dec 15 '10 at 23:05

1 Answer 1

up vote 3 down vote accepted

I guess I was making a Noob mistake it looks like I forgot to copy Roads.dbf to the target directory.

share|improve this answer
    
glad you have an answer –  CDBrown Dec 15 '10 at 23:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.