'EXAMPLE CODE FROM THE FORM
'oVendor and oAnalyzer declared PRIVATE
'and instantiated at form load
Private Sub btnCreateMessage_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnCreateMessage.Click
Try
Dim strFN As String
Dim enErrorType As EHL7_mc2005.HL7FileAnalyzer.EHFA_ErrorType
Dim i As Long
cmbMessages.Items.Clear()
cmbMessages.Visible = False
lblMessages.Visible = False
Button3.Visible = False
Button4.Visible = False
With oVendor
strFN = .EasyInstallationFolder & "AnonymousHL7Messages.HL7"
If Not IsFile(strFN) Then
MsgBox("The sample file AnonymousHL7Messages.HL7 not found in the invocation folder")
Exit Sub
End If
MouseON()
enErrorType = oAnalyzer.AnalyzeHL7File(strFN)
If enErrorType <> EHL7_mc2005.HL7FileAnalyzer.EHFA_ErrorType.EHFA_NoError Then
MouseOff()
MsgBox("An error occurred analyzing the file. Type = " & _
CStr(enErrorType), MsgBoxStyle.Critical, "Error")
Exit Sub
End If
MouseOff()
MsgBox("The analysis completed. The file contains " & oAnalyzer.FileMessageCount & " messages.")
End With
With oAnalyzer
For i = 1 To .FileMessageCount
cmbMessages.Items.Add(CStr(i))
Next
End With
If cmbMessages.Items.Count > 0 Then
cmbMessages.Visible = True
lblMessages.Visible = True
MsgBox("Select a message # in the listbox above to see the HL7 message!")
End If
Catch ex As Exception
MouseOff()
MsgBox(ex.ToString)
End Try
End Sub
|