Summary Statistics and then look for values with a count of 2 or higher. Relate or join to get the selection on the original features. Then do whatever you need to do to deal with them. This method is so fast and easy, I have not found a reason to program an alternative.
Thank you for your reply. But how do you achieve that?here is my code for it but unfortunately, it counting the total features in the field.
Try
'Defining the Layer selected by the end user
Dim layer As String = ComboBoxLayerName.SelectedItem
'Converting the layer into a feature class
Dim fclass As IFeatureClass = flayer(layer).FeatureClass
'defining the field to be checked
Dim fieldToCheck As IField = Nothing
Dim fields As IFields = fclass.Fields
Dim t As Integer = 0
Do While (t < fields.FieldCount)
If fields.Field(t).Name = ComboBoxFieldName.SelectedItem Then
fieldToCheck = fields.Field(t)
Exit Do
End If
t = t + 1
Loop
'define the cursor to store data
Dim pCursor As ICursor
'define datastat to query unique values
Dim pDataStats As New ESRI.ArcGIS.Geodatabase.DataStatistics
'define data collection
Dim pEnum As System.Collections.IEnumerator
Dim duplicateNumber As Integer
Dim duplicateValue As Integer = pDataStats.UniqueValueCount '(DuplicateValue here returns the total records in the field)
ListViewResults.Items.Clear()
pCursor = fclass.Search(Nothing, False)
pDataStats.Field = fieldToCheck.Name
pDataStats.Cursor = pCursor
pEnum = pDataStats.UniqueValues '(pEnum get Unique Values in the field)
pEnum.Reset()
Dim pListItem As New ListViewItem
Do While pEnum.MoveNext
duplicateNumber = pDataStats.UniqueValueCount
ListViewResults.Items.Add(pEnum.Current)
ListViewResults.Items(0).SubItems.Add(pDataStats.UniqueValueCount.ToString) '(return the total records number but not the number for each repeated records)
Loop
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try