NetReceiveCFindResponse Example for VB.NET

'LEADDICOMNet1 is a predefined LEADDicomNet object
'LEADDICOM1 is a DICOM Dataset defined outside this method
'This example uses the predefined variable "nFileCount" of type "Integer"
Private Sub LEADDICOMNet1_NetReceiveCFindResponse(ByVal hNet As Integer, ByVal nPresentationID As Short, ByVal nMessageID As Short, ByVal pszClass As String, ByVal nStatus As Integer, ByVal hDS As Integer) Handles LEADDICOMNet1.NetReceiveCFindResponse
   Dim strPeerAddress As String
   Dim strStatus As String
   Dim strMsg As String
   Dim strFileName As String

   strPeerAddress = LEADDICOMNet1.GetPeerAddress(hNet)

   If nStatus = LTDNCLib.DicomCommandStatusConstants.COMMAND_STATUS_PENDING Then
      strStatus = "COMMAND_STATUS_PENDING"
   End If

   If nStatus = LTDNCLib.DicomCommandStatusConstants.COMMAND_STATUS_SUCCESS Then
      strStatus = "COMMAND_STATUS_SUCCESS"
   End If

   If nStatus = LTDNCLib.DicomCommandStatusConstants.COMMAND_STATUS_CANCEL Then
      strStatus = "COMMAND_STATUS_CANCEL"
   End If

   strMsg = "*** OnNetReceiveCFindResponse ***" & vbNewLine & "Peer[" & strPeerAddress & "]" & vbNewLine & "nPresentationID[" & Str(nPresentationID) & "]" & vbNewLine & "nMessageID[" & Str(nMessageID) & "]" & vbNewLine & "pszClass[" & pszClass & "]" & vbNewLine & "strStatus[" & strStatus & "]" & vbNewLine

   If (hDS <> 0) Then
      'nFileCount is used to track the current CFindRequest responses count.
      nFileCount = nFileCount + 1
      strFileName = "d:\temp\CFind" & Str(nFileCount) & ".dic"
      LEADDICOM1.SaveExtDS(hDS, strFileName, 0)
      strMsg = strMsg & "Saving[" & strFileName & "]"
   End If
   MessageBox.Show(strMsg)
End Sub