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.

How can i get the Object ID for the last feature created ? i use m_editEvents_OnSketchFinished() event to run some code, but i can't get the OID of the most recent added feature.

share|improve this question
1  
Dude, please give us more context for your questions, ArcGIS Server? Arcobjects? ArcMap? Addin? Windows? etc.etc. OID - of what? geodatabase? shapefile? SDE? –  valveLondon Jun 18 '12 at 6:44
    
i have a polyline featureClass.mdb , when i draw a new feature (line) in ArcMap i want to get the OID for this feature (line). how do i do this? –  RASHOMON Jun 18 '12 at 6:51
add comment

1 Answer

up vote 2 down vote accepted

This is how to get the OID

   void _EditEvents_OnCreateFeature(IObject obj) {

                IFeature featureT;           
                if (obj is IFeature) {
                    featureT = (IFeature)obj;
                    int oid = featureT.OID;
          }
share|improve this answer
1  
you don't need to QI IFeature--IObject has OID/HasOID properties: help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/… –  Jay Cummins Jun 18 '12 at 9:47
    
you right, thanks –  RASHOMON Jun 18 '12 at 10:33
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.