SendCFindResponse 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 "TreeView1" of type "TreeView" from ".NET Framework".
Private Sub LEADDICOMNet1_NetReceiveCFindRequest(ByVal hNet As Integer, ByVal nPresentationID As Short, ByVal nMessageID As Short, ByVal pszClass As String, ByVal nPriority As Short, ByVal hDS As Integer)
   Dim x As Integer = 0
   Dim hPDU As Integer = 0
   Dim szAE As String = Nothing
   Dim NewNode As System.Windows.Forms.TreeNode = Nothing
   Dim nRet As Short = 0
   Dim szName As String = Nothing
   Dim szFile As String = Nothing
   Dim szReply As String = Nothing
   'this sample simple returns all the data sets that it is managing.
   'in a real-life scenario, this should perform an actual query based
   'on the attribute values supplied in hDS
   hPDU = LEADDICOMNet1.GetAssociate(hNet)
   szAE = LEADDICOMNet1.GetCalling(hPDU)
   NewNode = New System.Windows.Forms.TreeNode("Command Set - " & "C-FIND-REQUEST")
   TreeView1.Nodes.Add(NewNode)
   NewNode.EnsureVisible()
   NewNode.Nodes.Add("Presentation ID: " & System.Convert.ToString(nPresentationID))
   NewNode.Nodes.Add("Message ID: " & System.Convert.ToString(nMessageID))
   nRet = LEADDICOM1.FindUID(pszClass)
   If nRet = 0 Then
      szName = LEADDICOM1.get_CurrentUID().Name
      NewNode.Nodes.Add("Affected SOP Class: " & szName & " - " & pszClass)
   Else
      NewNode.Nodes.Add("Affected SOP Class: " & pszClass)
   End If
   NewNode.Nodes.Add("Priority: " & System.Convert.ToString(nPriority))
   'load sample file 1
   nRet = LEADDICOM1.LoadDS("e:\images\dicom16.dic", 0)
   If nRet = 0 Then
      LEADDICOMNet1.SendCFindResponse(hNet, nPresentationID, nMessageID, pszClass, CInt(LTDNCLib.DicomCommandStatusConstants.COMMAND_STATUS_PENDING), LEADDICOM1.hDicomDS)
   End If
   'send a Find Response - PENDING
   nRet = LEADDICOM1.LoadDS("e:\images\test.dic", 0)
   If nRet = 0 Then
      LEADDICOMNet1.SendCFindResponse(hNet, nPresentationID, nMessageID, pszClass, CInt(LTDNCLib.DicomCommandStatusConstants.COMMAND_STATUS_PENDING), LEADDICOM1.hDicomDS)
   End If
   'now, send a Find Response - SUCCESS
   LEADDICOMNet1.SendCFindResponse(hNet, nPresentationID, nMessageID, pszClass, CInt(LTDNCLib.DicomCommandStatusConstants.COMMAND_STATUS_SUCCESS), 0)
End Sub