Actually I was able to reach to this code after a long google search and some tweaks as I didn't get the code from here. However, I appreciate your effort. As this code works, I am changing the status of the thread to solved.