GetFloatValue Example for C#

//This example uses the predefined variable “Text1” of type “TextBox” from “.NET Framework”.
//LEADDICOM1 is a DICOM Dataset defined outside this method
private void TestGetFloatValue()
{
   int lCount = 0;
   int x = 0;
   short nRet = 0;
   LEADDICOM1.EnableMethodErrors = false;
   //move to the root element
   LEADDICOM1.MoveFirstElement(false);
   LEADDICOM1.MoveRootElement();
   //insert a new element for the Float Values
   LEADDICOM1.InsertElement(false, (int)LTDICLib.DicomDataSetTagConstants4.TAG_TABLE_OF_PARAMETER_VALUES, (short)LTDICLib.DicomVRCodeConstants.VR_FL, false, 0);
   Text1.Visible = true;
   Text1.Text = "";
   //insert some float values into the element
   LEADDICOM1.FloatValueCount = 5;
   for (x = 0; x < 5; x++)
   {
      LEADDICOM1.set_FloatValues(x, (float)(x * 1.99));
   }
   //set the floats
   nRet = LEADDICOM1.SetFloatValue(5);
   if (nRet != 0)
   {
      MessageBox.Show("Error");
      return;
   }
   LEADDICOM1.FloatValueCount = 0;
   //free the values
   Text1.Visible = true;
   Text1.Text = "";
   //get the value count
   lCount = LEADDICOM1.GetValueCount();
   MessageBox.Show("There are " + System.Convert.ToString(lCount) + " values!");
   //get the values
   nRet = LEADDICOM1.GetFloatValue(0, lCount);
   if (nRet == 0)
   {
      for (x = 0; x < LEADDICOM1.FloatValueCount; x++)
      {
         //display each value separated by a " X "
         Text1.Text = Text1.Text + " X " + System.Convert.ToString(LEADDICOM1.get_FloatValues(x));
      }
   }
   LEADDICOM1.EnableMethodErrors = true;
   MessageBox.Show("wait");
}