Marvin,
Check out Thread #
540510. Back in August, another user needed assistance in the same thing. I posted out an entire method that does exactly what you are looking for. Yes, other documents will help you understand, but it is a fully working version for you to play with and expand upon as a baseline.
HTH,
Don