InsertTag Example for Visual Basic
Private Sub Command10_Click()
Dim nRet As Integer
Dim ItemX As ListItem
Dim szItem As String
Dim nLen As Integer
Dim x As Integer
Dim szItemL As String
Dim szItemR As String
On Error GoTo INSERTTAGERROR
LEADDICOM1.EnableMethodErrors = False
nRet = LEADDICOM1.FindTag(131079)
If (nRet = 0) Then
MsgBox "Already Exists!"
Exit Sub
End If
nRet = LEADDICOM1.InsertTag(131079, -1, "My Test Tag", VR_OB, 1, 1, 1)
If (nRet <> 0) Then
MsgBox "Error"
End If
LEADDICOM1.EnableMethodErrors = True
'add item to the ListView control
Set ItemX = ListView1.ListItems.Add()
szItem = Hex$(LEADDICOM1.CurrentTag.Code)
nLen = Len(szItem)
szItemR = Right$(szItem, 4)
szItemL = ""
For x = nLen To 7
szItemL = szItemL & CStr(0)
Next
szItemL = szItemL & Left$(szItem, nLen - 4)
ItemX.Text = szItemL & ":" & szItemR
szItem = Hex$(LEADDICOM1.CurrentTag.Mask)
nLen = Len(szItem)
szItemR = Right$(szItem, 4)
szItemL = ""
For x = nLen To 7
szItemL = szItemL & CStr(0)
Next
szItemL = szItemL & Left$(szItem, nLen - 4)
ItemX.SubItems(1) = szItemL & ":" & szItemR
ItemX.SubItems(2) = LEADDICOM1.CurrentTag.Name
ItemX.SubItems(3) = CStr(LEADDICOM1.CurrentTag.VR)
ItemX.SubItems(4) = CStr(LEADDICOM1.CurrentTag.MinVM)
ItemX.SubItems(5) = CStr(LEADDICOM1.CurrentTag.MaxVM)
ItemX.SubItems(6) = CStr(LEADDICOM1.CurrentTag.DivideVM)
Set ListView1.SelectedItem = ListView1.FindItem(ItemX.Text)
ListView1.Refresh
ListView1.SetFocus
Exit Sub
INSERTTAGERROR:
MsgBox "Error"
End Sub