This is one fine example of how cumbersome sometimes it can be to reference the objects outside of the function's scope. What I mean is that if you have such a function written for one app and then you need to implement the same function for another app then it is easy to notice that the good old friend copy-paste does no longer work :(

If you modify the function to accept 4 string parameters (or 1 parameter of the string array type) then it would be a bit better, so instead of referencing the hardcoded text box names and hoping that these will never change, you can just use the values of the parameters instead: