|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: |
Private Function CheckFiles(ByVal FileName As String, ByVal SearchWord As String) As Boolean
'Searching for matching document and then pulling out the User name and Bith Date
Dim IsWordFound As Boolean = False
Dim strLine, strUserName, strBDate, orgStrLine As String
Dim FileContents As String = String.Empty
Dim FileStreamReader As StreamReader
Dim MyCrLf As String
Const MyCr As String = Microsoft.VisualBasic.ControlChars.Cr
Const MyTab As String = Microsoft.VisualBasic.ControlChars.Tab
MyCrLf = Chr(13) + Chr(10)
'Dim fulWordFile As New Microsoft.Office.Interop.Word.Application
'Dim Doc As Microsoft.Office.Interop.Word.Application
Dim bFlag As Boolean = False
Dim bFlagName As Boolean = False
Dim bFlagBirth As Boolean = False
Try
FileStreamReader = New StreamReader(FileName)
FileContents = FileStreamReader.ReadToEnd()
Catch ex As Exception
MsgBox(ex.ToString)
IsWordFound = False
Finally
If Not (FileStreamReader Is Nothing) Then
FileStreamReader.Close()
End If
End Try
If FileContents.IndexOf(SearchWord) > 0 Then
'IndexOf returns -1 of not found and 0 if the textVal is empty
Dim lstItem As New ListViewItem
Try
Dim objWord As New Word.Application
Dim objDoc As Word.Document
objDoc = objWord.Documents.Open(FileName:=FileName, ReadOnly:=True)
objDoc.Activate()
strLine = objDoc.Content.Text
'orgStrLine = strLine
Do While Not bFlag
If InStr(UCase(strLine), "PATIENT NAME:") Or InStr(UCase(strLine), "BIRTH DATE:") Then
Dim intPatient, intBDay, intPatientSpace, intBDaySpace, intLength As Integer
Dim strPatient, strBDay As String 'temp string holders
If InStr(UCase(strLine), "PATIENT NAME:") Then
'To find the patient name we will trim the string down to just after the Patient Name: statment
'then we will find the space that follows the coma and finally the end space
intPatient = InStr(UCase(strLine), "PATIENT NAME:")
intLength = Microsoft.VisualBasic.Len(strLine)
strUserName = Microsoft.VisualBasic.Right(strLine, (intLength - intPatient) - 13)
intLength = Microsoft.VisualBasic.Len(strUserName)
intPatient = InStr(UCase(strUserName), "BIRTH DATE:")
strPatient = Microsoft.VisualBasic.Left(strUserName, intPatient - 1)
strPatient = Replace(strPatient, MyTab, "")
strUserName = strPatient.Trim
lstItem.Text = strUserName
lstItem.Tag = FileName
'lstItem.SubItems.Add = FileName
bFlagName = True
End If
If InStr(UCase(strLine), "BIRTH DATE:") Then
intBDay = InStr(UCase(strLine), "BIRTH DATE:")
intLength = Microsoft.VisualBasic.Len(strLine)
If InStr(UCase(strLine), "PATIENT ID") Or InStr(UCase(strLine), "MEDICAL RECORD #:") Then
'strip everthing before the date, using 11 as a offset becasue there are 11 letters in Birth Date: string
strBDate = Microsoft.VisualBasic.Right(strLine, (intLength - intBDay) - 11)
'orgStrLine = Microsoft.VisualBasic.Right(strLine, (intLength - intBDay) - 13)
intLength = Microsoft.VisualBasic.Len(strBDate)
intBDay = InStr(UCase(strBDate), MyCr)
'intBDay = InStr(UCase(strBDate), "PATIENT ID")
strBDay = Microsoft.VisualBasic.Left(strBDate, intBDay - 1)
strBDay = Replace(strBDay, MyTab, "")
strBDate = strBDay.Trim
Else
strBDate = "Not Found"
End If
lstItem.SubItems.Add(strBDate)
lstItem.Tag = FileName
bFlagBirth = True
End If
lstDocs.Items.Add(lstItem)
'Releasing the evil COM object
System.Runtime.InteropServices.Marshal.ReleaseComObject(objDoc)
objDoc = Nothing
'closing the hidden Word document
objWord.Application.Quit()
objWord = Nothing
lstDocs.Refresh()
End If
If bFlagName And bFlagBirth Then
bFlag = True
End If
Loop
IsWordFound = True
Catch ex As Exception
MsgBox(ex.ToString)
IsWordFound = False
Finally
If Not (FileStreamReader Is Nothing) Then
FileStreamReader.Close()
End If
End Try
End If
Return IsWordFound
FileContents = String.Empty
End Function
|
Advertisement
| Hall of Fame |