You are here: > ESRI Forums > arcgis desktop discussion forums > Thread Replies

ArcGIS Desktop Discussion Forums

ArcGIS Desktop - ArcObjects Visual Basic for Application (VBA) forum

ArcMap Edit - Create Feature - ObjectID aut...   tony david Mar 31, 2004
Re: ArcMap Edit - Create Feature - ObjectID...   James Crandall Mar 31, 2004
Re: ArcMap Edit - Create Feature - ObjectID...   Nazar Albarghsh Mar 03, 2005
Re: ArcMap Edit - Create Feature - ObjectID...   Pierre Vos Mar 31, 2004
Re: ArcMap Edit - Create Feature - ObjectID...   tony david Mar 31, 2004
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject ArcMap Edit - Create Feature - ObjectID auto add 
Author tony david 
Date Mar 31, 2004 
Message Hi there, I have an Road_ID field and would like to add a String with ObjectID whenever I create a new feature... in ArcMap during Edit session.

For example, Road_ID = RD10454 where RD is the String and 10454 is the ObjectID from ArcMap.

I know we can use Calculate function to do it but what if I want the Road_ID to be create automatically when I create the feature...

any idea?? please advise... 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: ArcMap Edit - Create Feature - ObjectID auto add 
Author James Crandall 
Date Mar 31, 2004 
Message Use the "ThisDocument"....

Here is a great thread that should explain everything to you. Neil lays out a great explaination of using the obj. Once you have the OID value, you can add on whatever characters you wish with some basic VB string funtions.

http://forums.esri.com/Thread.asp?c=93&f=992&t=80208&mc=8

Also -- below is a little portion of code from the "ThisDocument" in VBA that I use to do exactly what you are trying to accomplish.

Hope this helps,

 
Private Sub EditorEvents_OnCreateFeature(ByVal obj As IObject)

Dim FeatClsOID As Long

'Get the OID of the newly created feature
 Dim pRowFC As IRow
  Set pRowFC = obj
   If obj.HasOID Then
   FeatClsOID = obj.OID
 End If

'build the PKID field in the point FeatCls    
Dim pkID_pt As String
pkID_pt = FeatClsOID & "_PT"
    pRowFC.Value(pRowFC.Fields.FindField("PKID")) = pkID_pt
   'Send edits to SDE
    pRowFC.Store
 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: ArcMap Edit - Create Feature - ObjectID auto add 
Author Nazar Albarghsh 
Date Mar 03, 2005 
Message i try to creat customize icon using Vb cods to manualy select feature and assign attribuite to all using some math calculation.

Thanks 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: ArcMap Edit - Create Feature - ObjectID auto add 
Author Pierre Vos 
Date Mar 31, 2004 
Message Once the feature is created, you may read it's OID 
 
Set pFeature = pFeatureClass.CreateFeature
With pFeature
	.value(.Fields.FindField("Road_ID")) = sStringRoad & .OID
	.store
end with
 
  Pierre VOS 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: ArcMap Edit - Create Feature - ObjectID auto add 
Author tony david 
Date Mar 31, 2004 
Message Thanks... But I found out a better way to code this by Implementing the IObjectClassEvents Class Extension Interface.