The error message tells you that there is zero
Controls
.
Check the
Count
of
Controls
before assuming that
Controls[0]
exist.
[Update]
Use the debugger to see exactly where is the problem and the variables contain at the problem.
The debugger allow you to follow the execution line by line, inspect variables and you will see that there is a point where it stop doing what you expect.
Debugger - Wikipedia, the free encyclopedia[
^]
Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[
^]
The debugger is here to show you what your code is doing and your task is to compare with what it should do.
When the code don't do what is expected, you are close to a bug.