Null reference exception was unhandled by user code error from ArcObjects and c#?

المشرف العام

Administrator
طاقم الإدارة
I'm new in programming . i'd like to write a simple code that can create offset from a polyline . i wrote the below code but when run the code i encounter to the error " Null reference exception was unhandled by user code" in line construct.ConstructOffset(pfeaturelayer as IPolyline, 100.3 , missing,missing);how can i solve the problem ?

public partial class copyparallel : Form { IApplication papp; public IHookHelper phookhelper; IPolycurve ppolycurve; public copyparallel() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { IFeatureLayer pfeaturelayer; IFeatureClass pfc; pfeaturelayer = (IFeatureLayer) phookhelper.FocusMap.get_Layer(0); pfc = pfeaturelayer.FeatureClass; IConstructCurve construct = new PolylineClass(); object offset = esriConstructOffsetEnum.esriConstructOffsetMitered; object missing = Type.Missing; construct.ConstructOffset(pfeaturelayer as IPolyline, 100.3 , missing,missing); IFeatureClass poutfc; IFeature newf = pfc.CreateFeature(); newf.Shape = (IGeometry)construct; newf.Store(); } } }

أكثر...
 
أعلى