SendNGetRequest 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 "gszGetFile" of type "String"
Private Sub TestSendNGetRequest ( )
   Const UID_SC_IMAGE_STORAGE As String = "1.2.840.10008.5.1.4.1.1.7"
   ' Secondary Capture Image Storage
   Dim nRet As Short
   Dim szClassUID As String
   Dim szInstance As String
   Dim nVR As Short
   Dim hPDU As Integer
   Dim nID As Short
   'send an N-GET-REQUEST to the server
   'gszGetFile is a predefined variable used in the NetReceiveNGetResponse event
   gszGetFile = InputBox("Select filename for retrieved data set", "Get Request", "d:\temp\N_GET_REQ.dic")
   If (Len(gszGetFile) < 1) Then Exit Sub
   szClassUID = InputBox("What class do you wish to get?", "Get Request", UID_SC_IMAGE_STORAGE)
   If (Len(szClassUID) < 1) Then Exit Sub
   szInstance = InputBox("What instance do you wish to get?", "Get Request", "1.1.1.1")
   If (Len(szInstance) < 1) Then Exit Sub
   'here, you must create a list of the identifiers 'that you wish to get from the server
   LEADDICOMNet1.RequestAttributeCount = 4
   LEADDICOMNet1.RequestAttributes(0) = LTDICLib.DicomDataSetTagConstants2.TAG_PATIENT_NAME
   LEADDICOMNet1.RequestAttributes(1) = LTDICLib.DicomDataSetTagConstants2.TAG_PATIENT_ID
   LEADDICOMNet1.RequestAttributes(2) = LTDICLib.DicomDataSetTagConstants2.TAG_PATIENT_SEX
   LEADDICOMNet1.RequestAttributes(3) = LTDICLib.DicomDataSetTagConstants5.TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES
   hPDU = LEADDICOMNet1.GetAssociate(LEADDICOMNet1.hNet)
   'now, send a request
   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.SendNGetRequest(LEADDICOMNet1.hNet, nID, 1, szClassUID, szInstance)
End Sub