GetPresentationAbstract Example for VB.NET

'LEADDICOMNet1 is a predefined LEADDicomNet object
Private Sub TestGetPresentationAbstract ( )
   Const UID_CR_IMAGE_STORAGE As String = "1.2.840.10008.5.1.4.1.1.1"
   ' Computed Radiography Image Storage
   Dim x As Integer
   Dim out As String
   Dim result As String
   Dim nID As Short

   'create the Associate Class as Request
   LEADDICOMNet1.CreateAssociate(True)
   'set the Associate to the default
   LEADDICOMNet1.DefaultAssociate(LEADDICOMNet1.hPDU)

   'get abstracts for each Presentation Context out = ""
   For x = 0 To LEADDICOMNet1.GetPresentationCount (LEADDICOMNet1.hPDU) - 1
      nID = LEADDICOMNet1.GetPresentationID(LEADDICOMNet1.hPDU, x)
      result = LEADDICOMNet1.GetPresentationAbstract(LEADDICOMNet1.hPDU, nID)
      out = out & result
      out = out & Chr(13)
   Next
   MessageBox.Show(out)

   'change the abstracts
   For x = 0 To LEADDICOMNet1.GetPresentationCount(LEADDICOMNet1.hPDU) - 1
      nID = LEADDICOMNet1.GetPresentationID(LEADDICOMNet1.hPDU, x)
      LEADDICOMNet1.SetPresentationAbstract(LEADDICOMNet1.hPDU, nID, UID_CR_IMAGE_STORAGE)
   Next

   'redisplay out = ""
   For x = 0 To LEADDICOMNet1.GetPresentationCount(LEADDICOMNet1.hPDU) - 1
      nID = LEADDICOMNet1.GetPresentationID(LEADDICOMNet1.hPDU, x)
      out = out & LEADDICOMNet1.GetPresentationAbstract(LEADDICOMNet1.hPDU, nID)
      out = out & Chr(13)
   Next
   MessageBox.Show(out)

   LEADDICOMNet1.FreeAssociate(LEADDICOMNet1.hPDU)
End Sub