MoveFirstVR Example for VB.NET

'LEADDICOM1 is a DICOM Dataset defined outside this method
Private Sub TestMoveFirstVR()
   LEADDICOM1.EnableMethodErrors = True

On Error GoTo MOVEVRERROR

   LEADDICOM1.MoveFirstVR() DisplayVRItem() MessageBox.Show("wait")
   LEADDICOM1.MoveNextVR() DisplayVRItem() MessageBox.Show("wait")
   LEADDICOM1.MoveLastVR() DisplayVRItem() MessageBox.Show("wait")
   LEADDICOM1.MovePrevVR() DisplayVRItem() MessageBox.Show("wait")

MOVEVRERROR:

End Sub

'LEADDICOM1 is a DICOM Dataset defined outside this method
'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".
Private Sub DisplayVRItem()
   Dim nRestrict As Short

   LEADDICOM1.EnableMethodErrors = True

On Error GoTo DISPLAYERROR

   'display the items information
   Select Case LEADDICOM1.CurrentVR.Code
      Case LTDICLib.DicomVRCodeConstants.VR_AE
         Text1.Text = "AE"
      Case LTDICLib.DicomVRCodeConstants.VR_AS
         Text1.Text = "AS"
      Case LTDICLib.DicomVRCodeConstants.VR_AT
         Text1.Text = "AT"
      Case LTDICLib.DicomVRCodeConstants.VR_CS
         Text1.Text = "CS"
      Case LTDICLib.DicomVRCodeConstants.VR_DA
         Text1.Text = "DA"
      Case LTDICLib.DicomVRCodeConstants.VR_DS
         Text1.Text = "DS"
      Case LTDICLib.DicomVRCodeConstants.VR_DT
         Text1.Text = "DT"
      Case LTDICLib.DicomVRCodeConstants.VR_FD
         Text1.Text = "FD"
      Case LTDICLib.DicomVRCodeConstants.VR_FL
         Text1.Text = "FL"
      Case LTDICLib.DicomVRCodeConstants.VR_IS
         Text1.Text = "IS"
      Case LTDICLib.DicomVRCodeConstants.VR_LO
         Text1.Text = "LO"
      Case LTDICLib.DicomVRCodeConstants.VR_LT
         Text1.Text = "LT"
      Case LTDICLib.DicomVRCodeConstants.VR_OB
         Text1.Text = "OB"
      Case LTDICLib.DicomVRCodeConstants.VR_OW
         Text1.Text = "OW"
      Case LTDICLib.DicomVRCodeConstants.VR_PN
         Text1.Text = "PN"
      Case LTDICLib.DicomVRCodeConstants.VR_SH
         Text1.Text = "SH"
      Case LTDICLib.DicomVRCodeConstants.VR_SL
         Text1.Text = "SL"
      Case LTDICLib.DicomVRCodeConstants.VR_SQ
         Text1.Text = "SQ"
      Case LTDICLib.DicomVRCodeConstants.VR_SS
         Text1.Text = "SS"
      Case LTDICLib.DicomVRCodeConstants.VR_ST
         Text1.Text = "ST"
      Case LTDICLib.DicomVRCodeConstants.VR_TM
         Text1.Text = "TM"
      Case LTDICLib.DicomVRCodeConstants.VR_UI
         Text1.Text = "UI"
      Case LTDICLib.DicomVRCodeConstants.VR_UL
         Text1.Text = "UL"
      Case LTDICLib.DicomVRCodeConstants.VR_UN
         Text1.Text = "UN"
      Case LTDICLib.DicomVRCodeConstants.VR_US
         Text1.Text = "US"
      Case LTDICLib.DicomVRCodeConstants.VR_UT
         Text1.Text = "UT"
      Case Else
         Text1.Text = CStr(LEADDICOM1.CurrentVR.Code)
   End Select

   Text2.Text = LEADDICOM1.CurrentVR.Name
   Text3.Text = CStr(LEADDICOM1.CurrentVR.Length)

   nRestrict = LEADDICOM1.CurrentVR.Restrict
   nRestrict = (nRestrict And (Not LTDICLib.DicomVRRestrictionConstants.DICOM_VR_BINARY))
   nRestrict = (nRestrict And (Not LTDICLib.DicomVRRestrictionConstants.DICOM_VR_STRING))
   nRestrict = (nRestrict And (Not LTDICLib.DicomVRRestrictionConstants.DICOM_VR_TEXT))

   Select Case nRestrict
      Case LTDICLib.DicomVRRestrictionConstants.DICOM_VR_FIXED
         Text4.Text = "Fixed"
      Case LTDICLib.DicomVRRestrictionConstants.DICOM_VR_MAXIMUM
         Text4.Text = "Maximum"
      Case LTDICLib.DicomVRRestrictionConstants.DICOM_VR_MAXIMUM_GROUP
         Text4.Text = "Maximum Group"
      Case LTDICLib.DicomVRRestrictionConstants.DICOM_VR_ANY
         Text4.Text = "Any Length"
      Case LTDICLib.DicomVRRestrictionConstants.DICOM_VR_NOT_APPLICABLE
         Text4.Text = "Not Applicable"
      Case LTDICLib.DicomVRRestrictionConstants.DICOM_VR_MAX
         Text4.Text = "Max"
      Case Else
         Text4.Text = CStr(LEADDICOM1.CurrentVR.Restrict)
   End Select

   Text5.Text = CStr(LEADDICOM1.CurrentVR.UnitSize)

DISPLAYERROR:
End Sub