GetConvertValue Example for C#
//This example uses the predefined variable “Text5” of type
“TextBox” from “.NET Framework”.
//LEADDICOM1 is a DICOM Dataset defined outside this method
private void TestGetConvertValue()
{
short nRet = 0;
int lCount = 0;
int x = 0;
//add some values to the element
//note, this will only work for elements that have a VR that supports multiple
values
LEADDICOM1.EnableMethodErrors
= false;
LEADDICOM1.StringValueCount
= 3;
LEADDICOM1.set_StringValues(0,
System.Convert.ToString(3.45));
LEADDICOM1.set_StringValues(1,
System.Convert.ToString(9.99));
LEADDICOM1.set_StringValues(2,
System.Convert.ToString(1.11));
nRet = LEADDICOM1.SetConvertValue();
//free the current values
LEADDICOM1.StringValueCount
= 0;
//now get the values and display them
nRet = LEADDICOM1.GetConvertValue();
if (nRet == 0)
{
lCount = LEADDICOM1.StringValueCount;
Text5.Text = "";
for (x = 0; x < lCount; x++)
{
//display each value on a separate line
Text5.Text = Text5.Text + LEADDICOM1.get_StringValues(x)
+ '\r' + '\n';
}
}
LEADDICOM1.EnableMethodErrors
= true;
}