| Report Inappropriate Content
This Forum is closed for replies.
||Re: Label Expression Question
||Nov 23, 2004
||The fact that all your labels come up as zero leads me to believe that an integer is still being fed as the label expression. For example, if the expression read
then all labels would be zero, because "myfield" would be assumed to be a new variable, initialized as zero. int(0) = 0, so all labels would be zero.
The code below is working for me. If you try the code below and it still doesn't work for you, then I'm stumped.
Note that I'm testing this in ArcMap VBA, and I'm not using a MapControl (thus, the two lines involving the MapControl are different in the version I'm actually testing).
Dim pGeoLayer As IGeoFeatureLayer
Set pGeoLayer = MapControl1.Layer(0)
Dim pLabelEngine As ILabelEngineLayerProperties
Set pLabelEngine = New LabelEngineLayerProperties
Dim sLabel As String
sLabel = "int([" & "SHAPE_area" & "])"
pLabelEngine.Expression = sLabel
pLabelEngine.IsExpressionSimple = True
Dim pBOLayerProps As IBasicOverposterLayerProperties
Set pBOLayerProps = New BasicOverposterLayerProperties
pBOLayerProps.NumLabelsOption = esriOneLabelPerShape
Set pLabelEngine.BasicOverposterLayerProperties = pBOLayerProps
pGeoLayer.DisplayAnnotation = True
MapControl1.ActiveView.PartialRefresh esriViewGraphics, Nothing, Nothing
The University of Texas at Austin