BinaryValues2 Example for Visual Basic

Private Sub GetSetPrivateData(objDataSet As LEADDicomDS)
   Dim PrivateDataTag As Long
   Dim DicomRet As Integer
   Dim PrivateTagData() As Byte
   Dim lCount As Long
   Dim Index As Integer

   objDataSet.EnableMethodErrors = False
   PrivateDataTag = &H19100E

   ' I am assuming that the dataset already has the our private element
   DicomRet = objDataSet.FindFirstElement(PrivateDataTag, False)
   If DicomRet <> 0 Then
      Exit Sub
   End If
   'get the data
   lCount = objDataSet.CurrentElement.Length
   If lCount = 0 Then
      Exit Sub
   End If
   DicomRet = objDataSet.GetBinaryValue(lCount)
   If DicomRet <> 0 Then
      Exit Sub
   End If
   PrivateTagData = objDataSet.BinaryValues2
   For Index = 0 To lCount – 1
      PrivateTagData(Index) = PrivateTagData(Index) + 1
   Next
   objDataSet.BinaryValues2 = PrivateTagData
   objDataSet.SetBinaryValue lCount
End Sub