GetDoubleValue Example for VB.NET

'LEADDICOM1 is a DICOM Dataset defined outside this method
'This example uses the predefined variable "Text1" of type "TextBox" from ".NET Framework".
Private Sub TestGetDoubleValue()
   Dim lCount As Integer
   Dim x As Integer
   Dim nRet As Short

   LEADDICOM1.EnableMethodErrors = False
   'move to the root element
   LEADDICOM1.MoveFirstElement(False)
   LEADDICOM1.MoveRootElement()

   'insert a new element for the Double Values
   LEADDICOM1.InsertElement(False, LTDICLib.DicomDataSetTagConstants4.TAG_REFERENCE_PIXEL_PHYSICAL_VALUE_X, LTDICLib.DicomVRCodeConstants.VR_FD, False, 0)
   Text1.Visible = True
   Text1.Text = ""

   'insert some Double values into the element
   LEADDICOM1.DoubleValueCount = 5
   For x = 0 To 5 - 1
      LEADDICOM1.DoubleValues(x) = 10 * x * 199.77
   Next
   'set the floats
   nRet = LEADDICOM1.SetDoubleValue(5)

   If (nRet <> 0) Then
      MessageBox.Show("Error")
      Exit Sub
   End If
   LEADDICOM1.DoubleValueCount = 0 'free the values

   Text1.Visible = True
   Text1.Text = ""
   'get the value count
   lCount = LEADDICOM1.GetValueCount
   MessageBox.Show("There are " & CStr(lCount) & " values!")

   'get the values
   nRet = LEADDICOM1.GetDoubleValue(0, lCount)
   If (nRet = 0) Then
      For x = 0 To LEADDICOM1.DoubleValueCount - 1
         'display each value separated by a " X "
         Text1.Text = Text1.Text & " X " & CStr(LEADDICOM1.DoubleValues(x))
      Next
   End If
   LEADDICOM1.EnableMethodErrors = True

End Sub