InsertVR Example for C++Builder
int nRet;
Word nCode, nRestrict;
AnsiString sOutput;
LEADDicom1->EnableMethodErrors = false;
nCode = 20322;
nRet = LEADDicom1->FindVR(nCode);
if(nRet == SUCCESS)
{
ShowMessage("Already Exists!");
return;
}
LEADDicom1->EnableMethodErrors = true;
try
{
nRestrict = VR_FIXED | VR_TEXT;
LEADDicom1->InsertVR(nCode, "My Test VR", 64, nRestrict, 1);
/* add item to the ListView control */
sOutput = "VR Inserted:\n"
"Code: " + IntToStr(LEADDicom1->CurrentVR->Code) +
"\nName: " + LEADDicom1->CurrentVR->Name +
"\nLength: " + IntToStr(LEADDicom1->CurrentVR->Length) +
"\nRestrict: " + IntToStr(LEADDicom1->CurrentVR->Restrict) +
"\nUnitSize: " + IntToStr(LEADDicom1->CurrentVR->UnitSize);
ShowMessage(sOutput);
}
catch(ELEADDicomError *e)
{
ShowMessage("Error Number: " + IntToStr(LEADDicom1->Error));
}