GetStringValue Example for C++Builder
Cardinal uCount, x;
int nRet;
LEADDicom1->EnableMethodErrors = false;
/* move to the root element */
LEADDicom1->MoveFirstElement(false);
LEADDicom1->MoveRootElement();
/* insert a new element for the String Values */
LEADDicom1->InsertElement(false, TAG_IMAGE_TYPE, VR_CS, false, 0);
/* insert some string values into the element */
LEADDicom1->StringValueCount = 5;
for(x=0; x<5; x++)
LEADDicom1->StringValues[x] = "String #" + IntToStr(x + 1);
/* set the strings */
nRet = LEADDicom1->SetStringValue(5);
if(nRet != SUCCESS)
{
ShowMessage("Error Number: " + IntToStr(LEADDicom1->Error));
return;
}
LEADDicom1->StringValueCount = 0; /* free the values */
Memo1->Lines->Clear();
/* get the value count */
uCount = LEADDicom1->GetValueCount();
ShowMessage("There are " + IntToStr(uCount) + " values!");
/* get the values */
nRet = LEADDicom1->GetStringValue(0, uCount);
if(nRet == SUCCESS)
for(x=0; x<LEADDicom1->StringValueCount; x++)
/* display each value separated on a separate line */
Memo1->Lines->Add(LEADDicom1->StringValues[x]);
LEADDicom1->EnableMethodErrors = true;
ShowMessage("wait");