Here is the full code for the function and form load, I want to get the featureclass name and concatenate it with a string:
Public Sub FillDistricts(ByVal pclass As String, ByVal fieldname As String, ByVal pQF As String)
pWorkSpace = pGDBWSF.OpenFromFile("E:\ArcGis Engine Projects\Data Layers\SDE GDB\sde_gdb.gdb", 0)
' pEnumDataset = pWorkSpace.get_datasets(ESRI.ArcGIS.Geodatabase.esriDatasetType.esriDTFeatureDataset)
pEnumDataset = pWorkSpace.Datasets(esriDatasetType.esriDTFeatureDataset)
' pEnumDataset = pWorkSpace.Datasets(esriDatasetType.esriDTFeatureDataset)
'pEnumDataset.Reset()
pDataset = pEnumDataset.Next
Dim FCN As String
FCN = Gov_List.SelectedText
pFeatureworkspace = pGDBWSF.OpenFromFile("E:\ArcGis Engine Projects\Data Layers\SDE GDB\sde_gdb.gdb", 0)
Dim pTable As ITable
Dim pTableSort As ITableSort
Dim sFieldName As String = fieldname
Dim pCursor As ICursor
Dim pFeatureclass As IFeatureClass
pFeatureclass = pFeatureworkspace.OpenFeatureClass(pclass)
' Gets the attribute table from the passed layer
pTable = pFeatureclass
' 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 pQFilter As IQueryFilter
pQFilter = New QueryFilter
pQFilter.WhereClause = pQF
Dim pData As IDataStatistics
pData = New DataStatistics
pData.Field = fieldname
pCursor = pFeatureclass.Search(pQFilter, False)
'pCursor = pLayer
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
Dist_List.Items.Add(CStr(pEnumVar.Current)) '<--- this should add the values to your cmbLot Control
value = pEnumVar.MoveNext
Next
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim govlist As String
govlist = Gov_List.SelectedText
Dim gov As String = ""
gov = String.Concat(govlist, "_dist")
'gov = govlist & "_dist"
FillDistricts(gov, "DIST_NA", "Dist_NE <>' '")
End Sub