GetTransferCount Example for Visual Basic

Dim x As Long
    Dim out$
    Dim result As String
    
    'create the Associate Class as Request
    LEADDICOMNet1.CreateAssociate True
    'set the Associate to the default
    LEADDICOMNet1.DefaultAssociate LEADDICOMNet1.hPDU
    
    'display each Transfer Syntax for the first Presentation Context
    out$ = ""
    For x = 0 To LEADDICOMNet1.GetTransferCount (LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0)) - 1
        result = LEADDICOMNet1.GetTransferSyntax(LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0), x)
        out$ = out$ & result
        out$ = out$ & Chr(13)
    Next
    MsgBox out$
    
    'add a transfer syntax
    LEADDICOMNet1.AddTransferSyntax LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0), UID_IMPLICIT_VR_LITTLE_ENDIAN
    'display each Transfer Syntax for the first Presentation Context
    out$ = ""
    For x = 0 To LEADDICOMNet1.GetTransferCount (LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0)) - 1
        result = LEADDICOMNet1.GetTransferSyntax(LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0), x)
        out$ = out$ & result
        out$ = out$ & Chr(13)
    Next
    MsgBox out$
    
    'change them
    For x = 0 To LEADDICOMNet1.GetTransferCount (LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0)) - 1
        LEADDICOMNet1.SetTransferSyntax LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0), x, UID_EXPLICIT_VR_BIG_ENDIAN
    Next
    'display each Transfer Syntax for the first Presentation Context
    out$ = ""
    For x = 0 To LEADDICOMNet1.GetTransferCount (LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0)) - 1
        result = LEADDICOMNet1.GetTransferSyntax(LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0), x)
        out$ = out$ & result
        out$ = out$ & Chr(13)
    Next
    MsgBox out$
    
    'delete the last one
    LEADDICOMNet1.DeleteTransferSyntax LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0), LEADDICOMNet1.GetTransferCount (LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0)) - 1
    
    'display each Transfer Syntax for the first Presentation Context
    out$ = ""
    For x = 0 To LEADDICOMNet1.GetTransferCount (LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0)) - 1
        result = LEADDICOMNet1.GetTransferSyntax(LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0), x)
        out$ = out$ & result
        out$ = out$ & Chr(13)
    Next
    MsgBox out$
    
    LEADDICOMNet1.FreeAssociate LEADDICOMNet1.hPDU