kjulistened

'Error HRESULT E_FAIL has been returned from a call to a COM component' get selected.

Discussion created by kjulistened on Nov 4, 2013
Latest reply on Nov 5, 2013 by bruce.nielsen
Post my code at first:
 #region Member.
        private AxMapControl _MapCon = null;    //MapControl from the main form.
        private IGeometry _BufferResult = null;
        #endregion
        public FrmBufferAnalyst(AxMapControl mapControl) {
            this._MapCon = mapControl;
            InitializeComponent();
        }
        private void FrmBufferAnalyst_Load(object sender, EventArgs e) {
            ShowSelectedFeatures();
        }
        /// <summary>
        /// //Show selected feature.
        /// </summary>
        void ShowSelectedFeatures() {
            lbox_selectedFeature.Items.Clear();
            ISelection fSelection = this._MapCon.Map.FeatureSelection;
            IEnumFeature enumF = (IEnumFeature)fSelection;
            IFeature f = null;
            while((f = enumF.Next()) != null) {
                lbox_selectedFeature.Items.Add("Feature layer:" + f.Class.AliasName);
                lbox_selectedFeature.Items.Add("OID:" + f.OID);
                lbox_selectedFeature.Items.Add("-----");    //Separator.
            }
        }

Before,I used the same project to execute buffer analyst,such as compute the area or query feature within the buffered feature.It works well.
But now,when I select the specifed feature and past them into another form and load.But it throws exception when trying to get the 'OID' property.Is something wrong with my code?Thanks.

Outcomes