InsertVR Example for Visual Basic
Private Sub Command10_Click()
Dim nRet As Integer
Dim ItemX As ListItem
Dim nCode As Integer
Dim nRestrict As Integer
LEADDICOM1.EnableMethodErrors = True
On Error GoTo INSERTVRERROR
LEADDICOM1.EnableMethodErrors = False
nCode = 20322
nRet = LEADDICOM1.FindVR(nCode)
If (nRet = 0) Then
MsgBox "Already Exists!"
Exit Sub
End If
nRestrict = DICOM_VR_FIXED + DICOM_VR_TEXT
nRet = LEADDICOM1.InsertVR(nCode, "My Test VR", 64, nRestrict, 1)
If (nRet <> 0) Then
MsgBox "Error"
End If
'add item to the ListView control
Set ItemX = ListView1.ListItems.Add()
ItemX.Text = CStr(LEADDICOM1.CurrentVR.Code)
ItemX.SubItems(1) = LEADDICOM1.CurrentVR.Name
ItemX.SubItems(2) = CStr(LEADDICOM1.CurrentVR.Length)
ItemX.SubItems(3) = CStr(LEADDICOM1.CurrentVR.Restrict)
ItemX.SubItems(4) = CStr(LEADDICOM1.CurrentVR.UnitSize)
Set ListView1.SelectedItem = ListView1.FindItem(ItemX.Text)
ListView1.Refresh
ListView1.SetFocus
LEADDICOM1.EnableMethodErrors = True
Exit Sub
INSERTVRERROR:
MsgBox "Error"
End Sub