I am sorry to bother with what may be an easy question for most of you but i am new to ArcObjects (VBA 6.0) in ArcMap (ArcGIS 10.0) and i am really struggling here. I am trying to count the number of rows in a feature class attribute table. I have declared a feature cursor which i want to use later in the code to do some processing and field value calculation. (In the code below pFClass was declared to the IFeatureClass interface)
Dim pCursor As IFeatureCursor pCursor = pFClass.Search(Nothing, False) Dim pFeature As IFeature Set pFeature = pFCursor.NextFeature Dim LngCounter As Long Do Until pFeature Is Nothing LngCounter = LngCounter + 1 Set pFeature = pCursor.NextFeature LOOP
When i run this code to get the number of items in the table i use a msgbox to print the number to screen which is accurate. But then i Cannot reuse my pFeature because it is now nothing.
Other permutations i have tried include declaring 2 cursors and 2 IFeature objects and then using the first to get the total count and then the second to do subsequent calculations of the attribute table but to no avail. I looked at the ITable.rowCount but could not get that to work for me. I'd really appreciate some help on this.