IsRoleSelect Example for VB.NET

'LEADDICOMNet1 is a predefined LEADDicomNet object
Private Sub TestIsRoleSelect()
   Dim x As Integer
   Dim nID As Integer
   Dim szOut As String
   Dim nUser As Short
   Dim nProvider As Short

   'create the Associate Class as Request
   LEADDICOMNet1.CreateAssociate(True)
   'set the Associate to the default
   LEADDICOMNet1.DefaultAssociate(LEADDICOMNet1.hPDU)

   'indicate that we wish to serve as user for each SOP associated
   For x = 0 To LEADDICOMNet1.GetPresentationCount(LEADDICOMNet1.hPDU) - 1
      nID = LEADDICOMNet1.GetPresentationID(LEADDICOMNet1.hPDU, x)
      LEADDICOMNet1.SetRoleSelect(LEADDICOMNet1.hPDU, nID, True, LTDNCLib.PDURoleSelectConstants.PDU_ROLE_SUPPORT, LTDNCLib.PDURoleSelectConstants.PDU_ROLE_NON_SUPPORT)
   Next

   'now, display the information
   szOut = "Role Select Info" & Chr(13)
   For x = 0 To LEADDICOMNet1.GetPresentationCount(LEADDICOMNet1.hPDU) - 1
      nID = LEADDICOMNet1.GetPresentationID(LEADDICOMNet1.hPDU, x)
      szOut = szOut & "ID: " & CStr(nID)
      If (LEADDICOMNet1.IsRoleSelect(LEADDICOMNet1.hPDU, nID) = True) Then
         nUser = LEADDICOMNet1.GetUserRole(LEADDICOMNet1.hPDU, nID)
         nProvider = LEADDICOMNet1.GetProviderRole(LEADDICOMNet1.hPDU, nID)
         szOut = szOut & " User: " & CStr(nUser)
         szOut = szOut & " Provider: " & CStr(nProvider) & Chr(13)
      Else
         szOut = szOut & " No Role Select" & Chr(13)
      End If
   Next
   MessageBox.Show(szOut)
End Sub