MoveFirstTag Example for VB.NET

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

On Error GoTo MOVETAGERROR

   LEADDICOM1.MoveFirstTag() DisplayTagItem() MessageBox.Show("wait")
   LEADDICOM1.MoveNextTag() DisplayTagItem() MessageBox.Show("wait")
   LEADDICOM1.MoveLastTag() DisplayTagItem() MessageBox.Show("wait")
   LEADDICOM1.MovePrevTag() DisplayTagItem() MessageBox.Show("wait")

MOVETAGERROR:
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".
'This example uses the predefined variable "Text6" of type "TextBox" from ".NET Framework".
'This example uses the predefined variable "Text7" of type "TextBox" from ".NET Framework".
Private Sub DisplayTagItem()
   Dim szItem As String
   Dim szItemL As String
   Dim szItemR As String
   Dim nLen As Short
   Dim x As Short

   LEADDICOM1.EnableMethodErrors = True

On Error GoTo DISPLAYERROR

   szItem = Hex(LEADDICOM1.CurrentTag.Code)
   nLen = Len(szItem)
   szItemR = szItem.Substring(szItem.Length - 4)
   szItemL = ""
   For x = nLen To 7
      szItemL = szItemL & CStr(0)
   Next
   szItemL = szItemL & szItem.Substring(0, nLen - 4)
   Text1.Text = szItemL & ":" & szItemR

   szItem = Hex(LEADDICOM1.CurrentTag.Mask)
   nLen = Len(szItem)
   szItemR = szItem.Substring(szItem.Length - 4)
   szItemL = ""
   For x = nLen To 7
      szItemL = szItemL & CStr(0)
   Next
   szItemL = szItemL & szItem.Substring(0, nLen - 4)
   Text2.Text = szItemL & ":" & szItemR

   Text3.Text = LEADDICOM1.CurrentTag.Name

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

   Text5.Text = CStr(LEADDICOM1.CurrentTag.MinVM)
   Text6.Text = CStr(LEADDICOM1.CurrentTag.MaxVM)
   Text7.Text = CStr(LEADDICOM1.CurrentTag.DivideVM)

DISPLAYERROR:

End Sub