It does work. What is going wrong? Where have you put the code? Have you tried stepping through your code with F8?