SetCommandSet (DICOM Control) Example for VB.NET

'LEADDICOMNet1 is a predefined LEADDicomNet object
'LEADDICOM1 is a DICOM Dataset defined outside this method
Private Sub LEADDICOMNet1_NetReceiveData(ByVal hNet As Integer, ByVal nID As Short, ByVal hDicomCS As Integer, ByVal hDicomDS As Integer) Handles LEADDICOMNet1.NetReceiveData
   Dim nRet As Short
   'we have received a data message
   'copy the Command Set so we can examine its elements
   LEADDICOM1.SetCommandSet(hDicomCS)
   nRet = LEADDICOM1.FindFirstElement(LTDICLib.DicomCommandSetTagConstants.TAG_COMMAND_FIELD, False)
   nRet = LEADDICOM1.GetShortValue(0, 1)
   MessageBox.Show("Command Field = 0x" & Hex(LEADDICOM1.ShortValues(0)))
End Sub