VB code snippet for loading/analyzing a hospital MCD response


Private Sub LoadData_Click()

On Error GoTo Err_Trap

Dim bStatus As Boolean
Dim strAbort As String

Dim strXMLFile As String
strXMLFile = "Response452_Accepted01_sigmerlin.xml"

'### HospitalMCDResponseManager interface
Dim hospitalMCDResponseManagerEx As HOSPITALMCDRESPONSEMANAGER452Lib.HospitalMCDResponseManager
Set hospitalMCDResponseManagerEx = New HospitalMCDResponseManager

Dim strUsedXSD As String
Dim strFromEAN As String
Dim strToEAN As String
Dim bEncrypted As YesNoType

'### Retrieve the information about the xml file
'### This is important because we need to know whether the document is encrypted or not
bStatus = hospitalMCDResponseManagerEx.GetXMLInfo(strXMLFile, strUsedXSD, strFromEAN, strToEAN, bEncrypted)
If (bStatus) Then
    If (bEncrpted = YesNoType.enNo) Then
        '### HospitalMCDResponse interface
        Dim hospitalMCDResponseEx As HospitalMCDResponse
        '### Load the XML file
        bStatus = hospitalMCDResponseManagerEx.LoadXML(strXMLFile, "", "", hospitalMCDResponseEx)
        If (bStatus) Then
            Dim strExplanation As String
            Dim statusIn As StatusType
            Dim statusOut As StatusType
            '### Retrieve the status of the MCD request
            bStatus = hospitalMCDResponseEx.GetAcceptType(strExplanation, statusIn, statusOut)
            If bStatus Then
                MsgBox (strExplanation)
            Else
                hospitalMCDResponseManagerEx.GetAbortInfo (strAbort)
                MsgBox ("ERR=" + strAbort)
            End If
        Else
            hospitalMCDResponseManagerEx.GetAbortInfo (strAbort)
            MsgBox ("ERR=" + strAbort)
        End If
        '### print preview
        bStatus = hospitalMCDResponseManagerEx.Print("", enYes)
    Else
        MsgBox ("Encryption not supported in demo mode")
    End If
Else
    hospitalMCDResponseManagerEx.GetAbortInfo (strAbort)
    MsgBox ("ERR=" + strAbort)
End If




'### relase resources
Set hospitalMCDResponseEx = Nothing
Set hospitalMCDResponseManagerEx = Nothing

Exit Sub

Err_Trap:
    MsgBox "Error: " & Err.Description, vbCritical, _
           "Opps! Error" & Str$(Err.Number)


Set hospitalMCDResponseEx = Nothing
Set hospitalMCDResponseManagerEx = Nothing

End Sub