AnsweredAssumed Answered

LOW MEMORY - Issue arises as features collected

Question asked by lightswitch on Apr 13, 2012
Latest reply on Jun 11, 2012 by spraycan
Hi again,

I'm having an issue now with LOW MEM and I believe it could be something with my code, like I'm not setting objects back to nothing or I'm supposed to save something out?

This is just an idea since if I get the message and close ArcPad - saving out the map, then upon reopening it works fine...for a while until it happens again. Like a cache is getting full and needs clearing...

Here's the code, which was put together based on other threads (thank you!)


Sub AddFeature
  Dim dblX, dblY, objToolButton, blnLyrExists, strLayer
  'Get a reference to the tool button object
  Set objToolButton = ThisEvent.Object
  'Initialize blnLyrExists flag to False
  blnLyrExists = False
  'If layer exists, set the blnLyrExists flag to true
  Dim objLyr
  For Each objLyr in Map.Layers
    If StrComp (objLyr.Name, "ST", 1) = 0 Then
      blnLyrExists = True
   strLayer = "ST"
      Exit For
    End If
  'If layer does not exist:
  'Notify the user, return the tool button to its original state, and exit.
  If Not blnLyrExists Then
    MsgBox "The layer is not present in the current map.", vbExclamation, "Layer not present"
    Exit Sub
  End If
  'If the layer does exist:
  'Get the coordinates of the map where the user clicked
  dblX = Map.PointerX
  dblY = Map.PointerY
  'Get a reference to the Layer object
  Dim objLayer
  Set objLayer = Map.Layers("ST")
  'If the layer can be made editable, make it editable
  If objLayer.CanEdit Then
    objLayer.Editable = True
    'Add a new tree (point feature) at the clicked location
    Call Map.AddFeatureXY(dblX,dblY)
    'Return the tool button to its original state
  End If
End Sub