Quote:
Patient: it hurts when I hit myself on the head!
Doctor: well stop hitting yourself on the head!
Obviously some file/stream is being opened and you are trying to open it again
1) If you are running the exe again when one is already running then try to check for single instance running and exit if not :
c# - What is the correct way to create a single instance application? - Stack Overflow[
^]
2) If you are clicking inside the application then put a lock around the code in the click handler :
private object _lock = new object();
private void button1_click(object sender, EventArgs e)
{
lock(_lock)
{
}
}