Yeah, thanks for the reply. I see what you're saying.
I have now changed the design of the code entirely and gone for something a bit cleaner.
Instead of enumerating through several name=value pairs I am listing the IP addresses on one line (as one value), delimiting them with a ';' and then tokenizing the
string and splitting each IP into a part of an array object.
The best thing is it all works. So far......now its just some
unit testing to confirm it!!