I have attached a screenshot of the parameters I am using and have also attached my latest code. Please use this latest one to do your testing.
I actually included a method called OnTermination() at the very end of my code to close the streamwriter but maybe I haven't used it in the right way. Please take a look and let me know what you think. Many thanks.
Comment