MoveFirstVR Example for C#

//LEADDICOM1 is a DICOM Dataset defined outside this method
private void TestMoveFirstVR()
{
   try
   {
      LEADDICOM1.EnableMethodErrors = true;
      LEADDICOM1.MoveFirstVR();
      DisplayVRItem();
      MessageBox.Show("wait");
      LEADDICOM1.MoveNextVR();
      DisplayVRItem();
      MessageBox.Show("wait");
      LEADDICOM1.MoveLastVR();
      DisplayVRItem();
      MessageBox.Show("wait");
      LEADDICOM1.MovePrevVR();
      DisplayVRItem();
      MessageBox.Show("wait");
   }
   catch { }
}

//This example uses the predefined variable “Text1” of type “TextBox” from “.NET Framework”.
//This example uses the predefined variable “Text2” of type “TextBox” from “.NET Framework”.
//This example uses the predefined variable “Text3” of type “TextBox” from “.NET Framework”.
//This example uses the predefined variable “Text4” of type “TextBox” from “.NET Framework”.
//This example uses the predefined variable “Text5” of type “TextBox” from “.NET Framework”.
//LEADDICOM1 is a DICOM Dataset defined outside this method
private void DisplayVRItem()
{
   try
   {
      short nRestrict = 0;
      LEADDICOM1.EnableMethodErrors = true;
      //display the items information
      switch (LEADDICOM1.get_CurrentVR().Code)
      {
         case (short)LTDICLib.DicomVRCodeConstants.VR_AE:
            Text1.Text = "AE";
            break;
         case (short)LTDICLib.DicomVRCodeConstants.VR_AS:
            Text1.Text = "AS";
            break;
         case (short)LTDICLib.DicomVRCodeConstants.VR_AT:
            Text1.Text = "AT";
            break;
         case (short)LTDICLib.DicomVRCodeConstants.VR_CS:
            Text1.Text = "CS";
            break;
         case (short)LTDICLib.DicomVRCodeConstants.VR_DA:
            Text1.Text = "DA";
            break;
         case (short)LTDICLib.DicomVRCodeConstants.VR_DS:
            Text1.Text = "DS";
            break;
         case (short)LTDICLib.DicomVRCodeConstants.VR_DT:
            Text1.Text = "DT";
            break;
         case (short)LTDICLib.DicomVRCodeConstants.VR_FD:
            Text1.Text = "FD";
            break;
         case (short)LTDICLib.DicomVRCodeConstants.VR_FL:
            Text1.Text = "FL";
            break;
         case (short)LTDICLib.DicomVRCodeConstants.VR_IS:
            Text1.Text = "IS";
            break;
         case (short)LTDICLib.DicomVRCodeConstants.VR_LO:
            Text1.Text = "LO";
            break;
         case (short)LTDICLib.DicomVRCodeConstants.VR_LT:
            Text1.Text = "LT";
            break;
         case (short)LTDICLib.DicomVRCodeConstants.VR_OB:
            Text1.Text = "OB";
            break;
         case (short)LTDICLib.DicomVRCodeConstants.VR_OW:
            Text1.Text = "OW";
            break;
         case (short)LTDICLib.DicomVRCodeConstants.VR_PN:
            Text1.Text = "PN";
            break;
         case (short)LTDICLib.DicomVRCodeConstants.VR_SH:
            Text1.Text = "SH";
            break;
         case (short)LTDICLib.DicomVRCodeConstants.VR_SL:
            Text1.Text = "SL";
            break;
         case (short)LTDICLib.DicomVRCodeConstants.VR_SQ:
            Text1.Text = "SQ";
            break;
         case (short)LTDICLib.DicomVRCodeConstants.VR_SS:
            Text1.Text = "SS";
            break;
         case (short)LTDICLib.DicomVRCodeConstants.VR_ST:
            Text1.Text = "ST";
            break;
         case (short)LTDICLib.DicomVRCodeConstants.VR_TM:
            Text1.Text = "TM";
            break;
         case (short)LTDICLib.DicomVRCodeConstants.VR_UI:
            Text1.Text = "UI";
            break;
         case (short)LTDICLib.DicomVRCodeConstants.VR_UL:
            Text1.Text = "UL";
            break;
         case (short)LTDICLib.DicomVRCodeConstants.VR_UN:
            Text1.Text = "UN";
            break;
         case (short)LTDICLib.DicomVRCodeConstants.VR_US:
            Text1.Text = "US";
            break;
         case (short)LTDICLib.DicomVRCodeConstants.VR_UT:
            Text1.Text = "UT";
            break;
         default:
            Text1.Text = System.Convert.ToString(LEADDICOM1.get_CurrentVR().Code);
            break;
      }
      Text2.Text = LEADDICOM1.get_CurrentVR().Name;
      Text3.Text = System.Convert.ToString(LEADDICOM1.get_CurrentVR().Length);
      nRestrict = LEADDICOM1.get_CurrentVR().Restrict;
      nRestrict = (short)(nRestrict & (short)~LTDICLib.DicomVRRestrictionConstants.DICOM_VR_BINARY);
      nRestrict = (short)(nRestrict & (short)~LTDICLib.DicomVRRestrictionConstants.DICOM_VR_STRING);
      nRestrict = (short)(nRestrict & (short)~LTDICLib.DicomVRRestrictionConstants.DICOM_VR_TEXT);
      switch ( nRestrict )
      {
         case (short)LTDICLib.DicomVRRestrictionConstants.DICOM_VR_FIXED:
            Text4.Text = "Fixed";
            break;
         case (short)LTDICLib.DicomVRRestrictionConstants.DICOM_VR_MAXIMUM:
            Text4.Text = "Maximum";
            break;
         case (short)LTDICLib.DicomVRRestrictionConstants.DICOM_VR_MAXIMUM_GROUP:
            Text4.Text = "Maximum Group";
            break;
         case (short)LTDICLib.DicomVRRestrictionConstants.DICOM_VR_ANY:
            Text4.Text = "Any Length";
            break;
         case (short)LTDICLib.DicomVRRestrictionConstants.DICOM_VR_NOT_APPLICABLE:
            Text4.Text = "Not Applicable";
            break;
         case (short)LTDICLib.DicomVRRestrictionConstants.DICOM_VR_MAX:
            Text4.Text = "Max";
            break;
         default:
            Text4.Text = System.Convert.ToString(LEADDICOM1.get_CurrentVR().Restrict);
            break;
      }
      Text5.Text = System.Convert.ToString(LEADDICOM1.get_CurrentVR().UnitSize);
   }
   catch {    }
}