I didn't retype the code. It's the real complete code snippet.
And the attachment contains the full project.
Thanks!