Before I explain, I want to say that I already checked for this but found no useful answer, maybe you can help. I didn’t try yet to call an external method to do this as I’d rather to keep the code minimal.
What I need is to do in the Button1_Click
event a long list of actions and stuff BUT if at some point a condition is met, the whole process has to restart. What you would call a “recursive” process/function/call-it-what-you want. ONLY it doesn’t seem to work. Usually, as I’m aware of, you would use the button1.PerformClick()
to call on a button instructions/event handler instructions. So that’s what I’m doing. BUT it doesn’t work. What the instructions say is “if this is true, perform click”, so if the condition is not met, the rest of the instructions would get executed, viceversa the whole stuff would restart. Only, when the condition is met, the click instruction is in fact read by the program but it is not executed, meaning even though the condition is met, the whole process is not restarted and instead it goes on with the rest of the instructions. I also tried button1.Invoke(new Action(() => { button1.PerformClick(); }));
but it doesn’t work either.
So, is there some way to do this without trying to call an external method containing the instructions? I mean, I find it really weird the button click handler seems not possibly recursive.