I am using

((AxMapControl)myMap.AddShapeFile( directory, shapeFileName)

To display a shapefile which has road data. Now the roads display properly, but the road names aren't displaying. How can I turn on the roads?

I don't need exact instructions just point me in the right direction please. I'm sorry this is such a novice question. I'm using ArcEngine 2010 and C#.

1 Answer 1


Create the layer symbology in ArcMap and save it as a *.lyr and load the shape file using the *.lyr file Sample_Save_a_layerfile. The benefit to do this using a lyr-file is that you can easily change it later on without changing the code. Take a look here if you want to do it in code: Working with labels and annotation

Just to display the attribute:

ILayer layer = axMapControl1.Map.get_Layer(0);
IGeoFeatureLayer geoLayer = layer as IGeoFeatureLayer;
geoLayer.DisplayAnnotation = true;
axMapControl1.Refresh(esriViewDrawPhase.esriViewAll, null, null);
  • I just clicked "label features in this layer" , and saved and it worked, do you have any idea how to do this sequence programatically in ArcEngine?
    – patrick
    Commented Oct 26, 2010 at 14:32
  • 1
    Updated with resource on how to add labels using code. Commented Oct 26, 2010 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.