SendCStoreRequest Example for VB.NET

'LEADDICOMNet1 is a predefined LEADDicomNet object
'LEADDICOM1 is a DICOM Dataset defined outside this method
Private Sub TestSendCStoreRequest ( )
   Dim nRet As Short
   Dim hPDU As Integer
   Dim nID As Integer
   Dim szClassUID As String
   Dim szInstanceUID As String
   'send a store request to the server
   hPDU = LEADDICOMNet1.GetAssociate(LEADDICOMNet1.hNet)
   'pick the data set to send
   nRet = LEADDICOM1.LoadDS("e:\images\dicom16.dic", 0)
   If (nRet <> 0) Then
      MsgBox("Error Loading Data Set!", , "Error")
      System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default
      Exit Sub
   End If
   LEADDICOM1.FindFirstElement(LTDICLib.DicomDataSetTagConstants1.TAG_SOP_INSTANCE_UID, False)
   LEADDICOM1.GetStringValue(0, 1)
   szInstanceUID = LEADDICOM1.StringValues(0)
   LEADDICOM1.MoveFirstElement(False)
   LEADDICOM1.FindFirstElement(LTDICLib.DicomDataSetTagConstants1.TAG_SOP_CLASS_UID, False)
   LEADDICOM1.GetStringValue(0, 1)
   szClassUID = LEADDICOM1.StringValues(0)
   'send the command set
   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
      System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default
      Exit Sub
   End If
   LEADDICOMNet1.SendCStoreRequest(LEADDICOMNet1.hNet, nID, 999, szClassUID, szInstanceUID, LTDICLib.DicomCommandSetMessagePriorities.COMMAND_PRIORITY_MEDIUM, "", 0, LEADDICOM1.hDicomDS)
   System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default
End Sub