Thank you very much. This seems very promising, but I do not know where to place this code to test it. I have a main form and a ApplicationEvents.vb file.