MoveFirstTag Example for C++Builder

void DisplayItem(TLEADDicom * LEADDicom1)
{
   AnsiString sItem, sOut;

   LEADDicom1->EnableMethodErrors = true;
   try
   {
      sItem = IntToHex(LEADDicom1->CurrentTag->Code, 8);
      sOut = "Current Tag Info:\n"
         "Code: " + sItem.SubString(1, 4) + ":" + sItem.SubString(5, 4)+"\n";

      sItem = IntToHex(LEADDicom1->CurrentTag->Mask, 8);
      sOut = sOut + "Mask: " + sItem.SubString(1, 4) + ":" + sItem.SubString(5, 4)+"\n";

      sOut = sOut + "Name: " + LEADDicom1->CurrentTag->Name+"\n";

      switch(LEADDicom1->CurrentTag->VR)
      {
         case VR_AE:
            sItem = "AE";
            break;
         case VR_AS:
            sItem = "AS";
            break;
         case VR_AT:
            sItem = "AT";
            break;
         case VR_CS:
            sItem = "CS";
            break;
         case VR_DA:
            sItem = "DA";
            break;
         case VR_DS:
            sItem = "DS";
            break;
         case VR_DT:
            sItem = "DT";
            break;
         case VR_FD:
            sItem = "FD";
            break;
         case VR_FL:
            sItem = "FL";
            break;
         case VR_IS:
            sItem = "IS";
            break;
         case VR_LO:
            sItem = "LO";
            break;
         case VR_LT:
            sItem = "LT";
            break;
         case VR_OB:
            sItem = "OB";
            break;
         case VR_OW:
            sItem = "OW";
            break;
         case VR_PN:
            sItem = "PN";
            break;
         case VR_SH:
            sItem = "SH";
            break;
         case VR_SL:
            sItem = "SL";
            break;
         case VR_SQ:
            sItem = "SQ";
            break;
         case VR_SS:
            sItem = "SS";
            break;
         case VR_ST:
            sItem = "ST";
            break;
         case VR_TM:
            sItem = "TM";
            break;
         case VR_UI:
            sItem = "UI";
            break;
         case VR_UL:
            sItem = "UL";
            break;
         case VR_UN:
            sItem = "UN";
            break;
         case VR_US:
            sItem = "US";
            break;
         case VR_UT:
            sItem = "UT";
            break;
         default:
            sItem = IntToStr(LEADDicom1->CurrentTag->VR);
      }
      sOut = sOut + "VR: " + sItem +"\n";
      sOut = sOut + "MinVM: " + IntToStr(LEADDicom1->CurrentTag->MinVM)+"\n";
      sOut = sOut + "MaxVM: " +  IntToStr(LEADDicom1->CurrentTag->MaxVM)+"\n";
      sOut = sOut + "DivideVM: " +  IntToStr(LEADDicom1->CurrentTag->DivideVM);
      ShowMessage(sOut);
   }
   catch(ELEADDicomError *e)
   {
      ShowMessage("Error Number: " + IntToStr(LEADDicom1->Error));
   }
} /* end of DisplayItem */

void __fastcall TForm1::MoveTag1Click(TObject *Sender)

   LEADDicom1->MoveFirstTag();
   DisplayItem(LEADDicom1);

   LEADDicom1->MoveNextTag();
   DisplayItem(LEADDicom1);

   LEADDicom1->MoveLastTag();
   DisplayItem(LEADDicom1);

   LEADDicom1->MovePrevTag();
   DisplayItem(LEADDicom1);
}