gallant1

Convert VBA code to .Net help

Discussion created by gallant1 on Dec 9, 2010
Latest reply on Dec 9, 2010 by gallant1
Hello All,

I just convert my VBA code to .Net and all works fine when I run it, but i get a warning in Visual Studio that i don't know how to get rid of. Now my code takes the selected item and displays its values on a form. This works just fine but on the "pFCursor" I get the following warning.

Variable 'pFCursor' is passed by reference before it has been assigned a value. A null reference exception could result at runtime.


Dim pMap As IMap
pMap = pMxDoc.FocusMap

Dim pFLayer As IFeatureSelection
pFLayer = pMap.Layer(0)


Dim pFCursor As IFeatureCursor
pFLayer.SelectionSet.Search(Nothing, False, pFCursor)

Dim pF As IFeature
pF = pFCursor.NextFeature


Thanks,
Craig

Outcomes