InsertUID Example for VB.NET
'LEADDICOM1 is a DICOM Dataset defined outside this method
'This example uses the predefined variable "ListView1" of type "ListView" from ".NET Framework".
Private Sub TestInsertUID()
Dim nRet As Short
Dim ItemX As System.Windows.Forms.ListViewItem
LEADDICOM1.EnableMethodErrors = False
nRet = LEADDICOM1.FindUID("1.2.840.10008.1.3")
If (nRet = 0) Then
MessageBox.Show("Already Exists!")
Exit Sub
End If
LEADDICOM1.EnableMethodErrors = True
On Error GoTo INSERTUIDERROR
nRet = LEADDICOM1.InsertUID("1.2.840.10008.1.3", "My Test UID", LTDICLib.DicomUIDTypes.DICOM_UID_TYPE_OTHER)
If (nRet <> 0) Then
MessageBox.Show("Error")
End If
'add item to the ListView control
ItemX = New System.Windows.Forms.ListViewItem
ListView1.Items.Add(ItemX)
ItemX.Text = CStr(LEADDICOM1.CurrentUID.Code)
ItemX.SubItems.Add(LEADDICOM1.CurrentUID.Name)
ItemX.Selected = True
ListView1.Refresh()
ListView1.Focus()
LEADDICOM1.EnableMethodErrors = True
Exit Sub
INSERTUIDERROR:
MessageBox.Show("Error")
End Sub