AnnGetSelectList example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical only.

This example gets the number of selected annotation objects; then it gets an array of the selected object handles and checks to see if any of the objects in the array are polygons.

'Please note the following:
'LEADRasterView1 refers to a LEADRasterView control
'Global declarations
Private WithEvents RasterAnn As LEADRasterAnnotation
Private RasterAnnToolbar As LEADRasterAnnToolBar

'In the Form_Load method:
Set RasterAnn = New LEADRasterAnnotation
Set RasterAnnToolbar = New LEADRasterAnnToolBar
RasterAnn.AnnParentRasterView = LEADRasterView1
Dim lType As Long
   Dim a As Integer
   Dim bSelected As Boolean
   Dim uCount As Integer
   Dim RasterVar As New LEADRasterVariant
   bSelected = False
   RasterAnn.AnnGetSelectCount
   uCount = RasterAnn.AnnSelectCount  'get number of selected objects
   RasterAnn.AnnGetSelectList RasterVar  'get the handles of the selected objects
   MsgBox CStr(uCount) & " objects were selected"
   For a = 1 To uCount
      RasterAnn.AnnGetType RasterVar.LongItemValue(a - 1) 
      lType = RasterAnn.AnnType
      If lType = ANN_OBJECT_POLYGON Then  'Is the object a polygon? 
         bSelected = True
      End If
   Next
   If bSelected <> True Then
      MsgBox "No Polygon Objects were selected"
   End If