Hi All,The code below retrieves attributes from a shapefile and attempts to put them into a combobox. The majority of the code works fine, but towards the end, where the "value" object is declared is where things go wrong. The pEnumVar should be returning the next value in the row it's looking at, but instead it gets a Boolean value (True or False). It would be great if someone could post some feedback regarding this issue.Thanks for your time,Ruchira Welikala Public Sub Sort_Unique(ByVal pLayer As IFeatureLayer, ByVal fieldname As String, ByVal condition As IQueryFilter)
Dim pTable As ITable
Dim pTableSort As ITableSort
Dim sFieldName As String = fieldname
Dim pCursor As ICursor
Dim i As Integer
For i = 0 To pMap.LayerCount - 1
If pMap.Layer(i).Name = "Lots Improved" Then
pLayer = pMap.Layer(i)
' pWellLayer = pLayer
End If
Next
' Gets the attribute table from the passed layer
pTable = pLayer.FeatureClass
' This example sorts the specificed field name
pTableSort = New TableSort
With pTableSort
.Fields = sFieldName
.Ascending(sFieldName) = True
.Table = pTable
End With
' sort the table
pTableSort.Sort(Nothing)
' Loop through sorted records and add to a listbox
pCursor = pTableSort.Rows
Dim pData As IDataStatistics
pData = New DataStatistics
pData.Field = fieldname
pCursor = pLayer.Search(condition, False)
pData.Cursor = pCursor
Dim pEnumVar As System.Collections.IEnumerator
Dim value As Object
pEnumVar = pData.UniqueValues
value = pEnumVar.MoveNext
For i = 0 To pData.UniqueValueCount - 1
cmbLot.Items.Add(value)
value = pEnumVar.MoveNext
Next
End Sub