I recommend putting together an SSCCE that demonstrates exactly what you're doing.

And you should probably use a Timer instead of that infinite loop.