VBA 코드 C#으로 변환하려고합니다. 정말 가까워지고 있지만이 오류가 계속 발생하는 이유를 알 수 있습니다. 오류 메서드 그룹 'NextFeature'를 대리자가 아닌 유형 'ESRI.ArcGIS.Carto.IFeatureSelection'으로 변환 할 수 없습니다. 이 메소드를 호출하려고 했습니까?C# 메서드를 호출하려고 했습니까?
IFeatureCursor pFCursor = null;
pFLayer = pFCursor.NextFeature; // pFCursor is sure to be null
을하지만 그 런타임 오류 다음과 같습니다
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ESRI.ArcGIS.ArcMapUI;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Geodatabase;
namespace ArcMapAddin1
{
public partial class frmParcelReader : Form
{
public frmParcelReader()
{
InitializeComponent();
}
public void ReadData()
{
//IMxDocument pMxDoc = default(IMxDocument);
IMxDocument pMxDoc = ArcMapAddin1.ArcMap.Document;
//IMap pMap = default(IMap);
IMap pMap = pMxDoc.FocusMap;
//IFeatureSelection pFLayer = default(IFeatureSelection);
IFeatureLayer pLayer = pMap.get_Layer(0) as IFeatureLayer;
IFeatureSelection pFLayer = pLayer as IFeatureSelection;
string stopHere2 = "";
for (int Count = 0; Count <= pMap.LayerCount - 1; Count++) {
//if (pMap.LayerCount == "sde.GIS.parcels_adacounty")
if (pLayer.Name == "sde.GIS.parcels_adacounty")
{
//pFLayer = pMap.get_Layer(0)
//string thisString = pFLayer.SelectionSet.IDs.ToString();
IFeatureCursor pFCursor = null;
//pFLayer.SelectionSet.Search(null, false, pFCursor);
//IFeature pFLayer = pLayer(IFeature);
pFLayer = pFCursor.NextFeature;
if (pFLayer.SelectionSet.Count != 0) {
//lblParcel.Text = pF.Value.Fields.FindField("PARCEL");
//lblPrimaryOwner.Text = pF.Value(pF.Fields.FindField("PRIMOWNER"));
//lblMailingAddress.Text = pF.Value(pF.Fields.FindField("ADDCONCAT"));
//lblPropertyAddress.Text = pF.Value(pF.Fields.FindField("ADDRESS"));
} else {
//if (sender == "Button")
// MessageBox.Show("Please select a Parcel.");
}
break; // TODO: might not be correct. Was : Exit For
}
}
}
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
private void button1_Click(object sender, EventArgs e)
{
ReadData();
}
}
}
무엇 pFCursor.NextFeature 반환합니까? pfLayer의 유형 객체 인 경우 pFLayer = pFCursor.NextFeature를 변경하려고합니다. ~ pFCayer = pFCursor.NextFeature(); –