SendNDeleteRequest Example for VB.NET

'LEADDICOMNet1 is a predefined LEADDicomNet object
'LEADDICOM1 is a DICOM Dataset defined outside this method
Private Sub TestSendNDeleteRequest ( )
   Const UID_SC_IMAGE_STORAGE As String = "1.2.840.10008.5.1.4.1.1.7"
   ' Secondary Capture Image Storage
   Dim szClassUID As String
   Dim szInstanceUID As String
   Dim nID As Short
   Dim hPDU As Integer
   Dim nRet As Short
   hPDU = LEADDICOMNet1.GetAssociate(LEADDICOMNet1.hNet)
   szClassUID = InputBox("Enter SOP Class to Delete:", "Delete", UID_SC_IMAGE_STORAGE)
   szInstanceUID = InputBox("Enter SOP Instance to Delete:", "Delete", "1.2.840.113619.2.30.1.1762288927.1489.906240296.255")
   'send a Delete Request Command to the server
   nID = LEADDICOMNet1.FindPresentationAbstract(hPDU, szClassUID)
   If (nID = 0) Then
      nRet = LEADDICOM1.FindUID(szClassUID)
      If (nRet = 0) Then
         MessageBox.Show("Abstract Syntax, " & LEADDICOM1.CurrentUID.Name & ", Not Supported by Association!")
      Else
         MessageBox.Show("Abstract Syntax, " & szClassUID & ", Not Supported by Association!")
      End If
      Exit Sub
   End If
   LEADDICOMNet1.SendNDeleteRequest(LEADDICOMNet1.hNet, nID, 999, szClassUID, szInstanceUID)
End Sub