Did you have already a look at this or this?
Btw. Quoting the code would help the reader of your post