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.

I am writing an add-in for ArcMap 10. I am trying to do Dim clickedPoint as IPoint in VB.NET, but I get "Type 'IPoint' is not defined" error. Do I have to import a class or how do I make this work?

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

Yes, since you are presumably using VB.NET (not VB, which is 20+ years old and no longer supported), you need to use the Imports statement to import namespaces.

Specifically you want to put Imports ESRI.ArcGIS.Geometry at the top of your code files.

Alternatively you could fully qualify the IPoint type every time you use it (ESRI.ArcGIS.Geometry.IPoint) but that gets old quick.

Tip: In Visual Studio, use the context-sensitive chip that appears when you hover over a type name with a missing namespace declaration, and click the first option to automatically add an Imports statement for the discovered namespace. This will only work as long as you have a reference to the type's assembly in your project and there is no ambiguity as to its namespace.

share|improve this answer
    
I tried all this, but it doesn't work. When I use the import statement it seems as though it can't find the Geometry class. I get a warning "Namespace or type specified in the Imports 'ESRI.ArcGIS.Geometry' doesn't contain any public member or cannot be found. etc etc etc" –  Xoph May 1 '12 at 17:20
2  
You need to add a reference to ESRI.ArcGIS.Geometry. In Solution Explorer -> Right Click on References -> Add Reference -> Select ESRI.ArcGIS.Geometry –  Jakub May 1 '12 at 17:49
3  
Instead of using "Add Reference", you should use "Add ArcGIS Reference", since that automatically sets the Specific Version to False. –  kenbuja May 1 '12 at 18:02
    
Thanks that worked great. –  Xoph May 1 '12 at 18:10
add comment

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.