Computer Science Canada

Index out of range exception error

Author:  amemoses [ Sun Nov 01, 2009 10:32 pm ]
Post subject:  Index out of range exception error

I need help handling Index outof range exception problem. It occur at the last line in this code
' Find and correct any "ei" where the preceding letter is not c
'
position = 0
Do While theInput.IndexOf("ei") <> -1
position = theInput.IndexOf("ei", position)
If theInput.Chars(position - 1).CompareTo(Convert.ToChar("c")) <> 0 Then


: