Without the rest of the code, and working with what you have given us, you have had 3 different answers that work. You just have to adapt one to your code OR provide a bit more of your code, maybe even share the project as zip, so that someone can try to see what's keeping it from working as expected.