GaryLa wrote:Per the documentation from MS, I don't understand why you're using Dispose in this manner: topform.Dispose();
"Disposes of the resources (other than memory) used by the Form." The MessageBox takes care of itself, why call Dispose for your "topform" after
some MessageBox calls (but not all of them)?
Also, without placing some of this code after an "#Events" statement, my understanding is your "loop" variable will always be 1. Setting it to 0 and then returning will have no effect -- it gets reloaded again to 1.
- Code: Select all
int loop = 1;
while(loop > 0) ....
loop = 0; //unless this is global, this statement has no actual effect
return;
I only copied this example of message box code from this forum and macros created in Screenset 2017 for the message box.
Also, as stated earlier, I know the loop is screwed up. Agreed that loop=0 followed be a return serves no purpose, but somehow my loop got stuck twice and just did that in case I has missed something else. Haven't had a stuck loop since doing it, and don't know why is happened in the first place. So just left them in until I had a better method of doing the loop. But yeah, basically was just stating loop while AnyVariable is true, which I've seen used before. It's just a way to keep it looping until a step out path leads it to a return.
LOL...never claimed to be a programmer, but trying to learn C#. My first experience in programming was with a Vic20 in 1980. In Tech school, they were only teaching basic, pascal, fortran and some other ancient languages, not C at the time. So programming over the years has just been out of necessity whenever required. Haven't had any formal training on it and just trying to get some experience with C# since it's now a necessity for me. I admitted from the beginning this macro was simply a hacked up version of other people's code, but also hitting up some videos and C# wiki trying to learn how to do it correctly.
Your feedback is appreciated and I will try to get a better understanding of the windows form thing to see how I should properly format it. I know it's not working correctly as some windows are still hiding behind others on occasion and it will allow you to restart the macro with an instance running. So yeah, a lot of work to be done from an error handling standpoint and making the while loop correct as far as layout and context.
Thanks to everyone for feedback and information. Don't give up on me yet, I'll get there one day...LOL.