SendNSetRequest Example for Visual Basic
Dim nRet As Integer
Dim szClassUID As String
Dim szInstance As String
Dim hPDU As Long
Dim nID As Integer
Dim szNewID As String
'this sample allows you to change the patient id of an SOP Instance
'send an N-GET-REQUEST to the server
szClassUID = InputBox("What class do you wish to set?", "Set Request", UID_SC_IMAGE_STORAGE)
If (Len(szClassUID) < 1) Then Exit Sub
szInstance = InputBox("What instance do you wish to set?", "Set Request", "1.1.1.1")
If (Len(szInstance) < 1) Then Exit Sub
szNewID = InputBox("Enter New Patient ID?", "Set Request", "123-45-6789")
If (Len(szNewID) < 1) Then Exit Sub
'create the data set that encodes the changed element(s)
LEADDICOM1.InitDS DICOM_CLASS_UNKNOWN, 0
LEADDICOM1.ResetDS
LEADDICOM1.FindTag TAG_PATIENT_ID
LEADDICOM1.InsertElement False, TAG_PATIENT_ID, LEADDICOM1.CurrentTag.VR, False, 0
LEADDICOM1.StringValueCount = 1
LEADDICOM1.StringValues (0) = szNewID
LEADDICOM1.SetStringValue 1
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
MsgBox "Abstract Syntax, " & LEADDICOM1.CurrentUID.Name & ", Not Supported by Association!"
Else
MsgBox "Abstract Syntax, " & szClassUID & ", Not Supported by Association!"
End If
Exit Sub
End If
LEADDICOMNet1.SendNSetRequest LEADDICOMNet1.hNet, nID, 1, szClassUID, szInstance, LEADDICOM1.hDicomDS