Thanks a million, Shabbir. It worked for me. Now i will continue on how to delete a line from the text file. I will do separate thread at some stage.