I'm new to ArcObjects and I'm finding it difficult to work with the ArcObjects 'Feature classes'. Coming to my problem, I have a Map with few layers. I have coded for the layer names to display in the first Combo-box and the Column names of the Layer selected from the first Combo-box will be displayed in the second Combo-box. The values of the Columns will be displayed in the third Combo-box(So far, So good). But now I'm working on a query that displays the values lesser than the value selected in my third Combo-box. I have been using VB.Net coding for this purpose. The query code runs something like this.
Dim hook = ComboBox1.SelectedIndex(Table number) Dim FClass = ComboBox1.Text(Table Name) Dim Field = ComboBox2.Text(Column Name of the table selected) Dim Value = ComboBox4.Text(values in the Column selected) Dim pMxDoc As IMxDocument = TryCast(m_application.Document, IMxDocument) Dim pMap As IMap = pMxDoc.FocusMap Dim pLayer As IFeatureLayer pLayer = pMap.Layer(hook) Dim pFeatureClass As IFeatureClass = pLayer.FeatureClass Dim pTable As ITable = pFeatureClass Dim FilePath As String FilePath = "D:\Harsha\ArcMap_CustomTools\EGISDATA\" Dim pWSFact As IWorkspaceFactory pWSFact = New ShapefileWorkspaceFactory Dim pFeatureWorkspace As IFeatureWorkspace pFeatureWorkspace = pWSFact.OpenFromFile(FilePath, hook) pLayer.Name = FClass pTable = pLayer Dim pQFilter As IQueryFilter pQFilter = New QueryFilter pQFilter.SubFields = Field pQFilter.WhereClause = "'" + Field + "' < '" + Value + "'" Dim pSelSet As ISelectionSet pSelSet = pTable.Select(pQFilter, esriSelectionType.esriSelectionTypeHybrid, esriSelectionOption.esriSelectionOptionNormal, pFeatureWorkspace) pMxDoc.ActiveView.Refresh() Dim pFeatureCursor As IFeatureCursor pSelSet.Search(pQFilter, False, pFeatureCursor) Dim iRecCount As Integer s = vbNullString Dim pFeature As IFeature pFeature = pFeatureCursor.NextFeature While Not pFeature Is Nothing iRecCount = iRecCount + 1 s = s & vbCrLf & pFeature.Value(Value) MsgBox(s) pFeature = pFeatureCursor.NextFeature End While
The problem is
pFeature is always
Nothing and it does not enter the