SetCommandSet (DICOM Control) Example for C#

//LEADDICOM1 is a DICOM Dataset defined outside this method
private void LEADDICOMNet1_NetReceiveData(int hNet, short nID, int hDicomCS, int hDicomDS)
{
   short nRet = 0;
   //we have received a data message
   //copy the Command Set so we can examine its elements
   LEADDICOM1.SetCommandSet(hDicomCS);
   nRet = LEADDICOM1.FindFirstElement((int)LTDICLib.DicomCommandSetTagConstants.TAG_COMMAND_FIELD, false);
   nRet = LEADDICOM1.GetShortValue(0, 1);
   MessageBox.Show("Command Field = 0x" + System.Convert.ToString(LEADDICOM1.get_ShortValues(0), 16).ToUpper());
}