MoveRootElement Example for Visual Basic
Private Sub DSDeleteModule_Click()
Dim nRet1 As Integer
Dim nRet2 As Integer
LEADDICOM1.EnableMethodErrors = True
On Error GoTo MOVEELEMENTERROR
'move to first element in Data Set
LEADDICOM1.MoveFirstElement False
LEADDICOM1.FindTag LEADDICOM1.CurrentElement.Tag
MsgBox "Element: " & LEADDICOM1.CurrentTag.Name
'move to next element in the same level of the Data Set
LEADDICOM1.MoveNextElement True
LEADDICOM1.FindTag LEADDICOM1.CurrentElement.Tag
MsgBox "Element: " & LEADDICOM1.CurrentTag.Name
'move to last element in the same level of the Data Set
LEADDICOM1.MoveLastElement True
LEADDICOM1.FindTag LEADDICOM1.CurrentElement.Tag
MsgBox "Element: " & LEADDICOM1.CurrentTag.Name
'move to previous element in the same level of the Data Set
LEADDICOM1.MovePrevElement True
LEADDICOM1.FindTag LEADDICOM1.CurrentElement.Tag
MsgBox "Element: " & LEADDICOM1.CurrentTag.Name
'find the first element that has a child
LEADDICOM1.EnableMethodErrors = False
nRet1 = LEADDICOM1.MoveFirstElement(False)
While nRet1 = 0
nRet2 = LEADDICOM1.MoveChildElement
If (nRet2 = 0) Then
LEADDICOM1.FindTag LEADDICOM1.CurrentElement.Tag
MsgBox "Element: " & LEADDICOM1.CurrentTag.Name
nRet1 = 1 'end loop
End If
If (nRet1 <> 1) Then
'check next element in this same level
nRet1 = LEADDICOM1.MoveNextElement(True)
End If
Wend
LEADDICOM1.EnableMethodErrors = True
'move back to the element's parent
If (nRet1 = 1) Then
LEADDICOM1.MoveParentElement
LEADDICOM1.FindTag LEADDICOM1.CurrentElement.Tag
MsgBox "Element: " & LEADDICOM1.CurrentTag.Name
End If
Exit Sub
MOVEELEMENTERROR:
MsgBox "Error"
End Sub