Enumerating Digital Signatures Example for VB.NET

Sub EnumerateSignatures(ByRef objDS As LTDICLib.LEADDicomDS)
   ' We will enumerate the Digital Signatures in the main Data Set

   Dim lSignaturesCount As Integer

   objDS.SetCurrentElement(0)
   lSignaturesCount = objDS.GetSignaturesCount()
   If lSignaturesCount = 0 Then
      MessageBox.Show("No Digital Signatures in the main Data Set.", "Sample")
      Exit Sub
   End If

   Dim sMsg As String

   If lSignaturesCount = 1 Then
      sMsg = "There is 1 Digital Signature in the main Data Set. " & "Do you want to examine it?"
   Else
      sMsg = "There are " & lSignaturesCount & " Digital Signatures in the main Data Set. " & "Do you want to examine them?"
   End If
   If MessageBox.Show(sMsg, "Sample", MessageBoxButtons.YesNo) <> DialogResult.Yes Then
      Exit Sub
   End If

   Dim I As Integer

   For I = 0 To lSignaturesCount - 1
      objDS.MoveSignature(I)

      ' Refer to Examining a Digital Signature Example
      ' for the procedure ExamineSignature
      ExamineSignature(objDS, objDS.CurrentElement.hElement)

      objDS.SetCurrentElement(0)
   Next
End Sub