<% Private Function CheckAround(ByVal HTML As String, ByVal Found As String, Optional ByVal SearchValue As String = "ISBN") As Integer Dim SearchTolerance As Integer = 100 Dim SearchMidRange As Integer = (SearchTolerance * 2) + Found.Length Dim MidStart As Integer Dim PosFound As Integer Dim MidHTML As String PosFound = HTML.IndexOf(Found) 'Must not be possible If PosFound < 1 Then MessageBox.Show("I can not found the supplied ISBN in given HTML Source", "Unknown Error !", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Function End If MidStart = PosFound - SearchTolerance 'Check around for possible out of index errors when HTML too short If MidStart < 0 Then MidStart = 1 If HTML.Length < MidStart + SearchMidRange Then SearchMidRange = HTML.Length - MidStart 'Get mid part of the HTML source MidHTML = HTML.Substring(MidStart, SearchMidRange) Dim Accuracy As Integer Accuracy = MidHTML.IndexOf(SearchValue) If Accuracy = -1 Then Return 0 Else Return CInt(Math.Floor(Accuracy * 100) / SearchTolerance) End If End Function %>