Have you ever considered using regular expressions for this? I am not sure if you are using .NET or VB 6, but both support the use of regular expressions (.NET has it built in and VB 6 needs the vbscript library).
The idea with regular expressions is that it look for patterns and creates matches. For instance... If I had the string "Area 51 - Page 3" I could throw a regular expression of
[0-9]+ against it and it would result in an array of matches. This array would have two elements... one match would be "51" and the second would be "3".
Then once you have your matches, all you would have to do is compare element 2 (the number 3) with element 2 of another string (lets say it was 4) and you would know which match is changing.
To give you an idea of how this works, you can try the following website...
Regular Expression LibraryAt the bottom you will see two boxes, the first will say "Source" and the second will say "Pattern". In the source box type
Area 51 - Page 3 and in the pattern box type
[0-9]+ and hits submit. Then scroll down to the bottom and you will see a place where it says "Matches" and shows you the two numbers from the string.
Once you try this out, I am sure your problems will dissolve like button on a hot skillet.
Let us know if you have any further questions.
"At DIC we be regular expression loving code ninjas!"
This post has been edited by Martyr2: 18 Nov, 2007 - 12:32 PM