This variable "i" should also be named something meaningful. Even in for loops with temp variables, Hungarian says you should name this iRegId or something, i stands for index, so it makes sense...iRegId would be an index into rgstRegId