1
Answer

Stopping new windows from being made when one just like it is already made

Administrator

Administrator

21y
1.5k
1
I have a form with textboxes that will only hold text without @Old at the end of the file. If a file does have @Old at the end it goes to the Rich Text Box of the PrintView form easy printing. if(Old) { PrintViewForm P=new PrintViewForm(); P.GetItFromFile(file); P.Show(); } The problem is that it is in a loop and need to be in a loop to work correctly. So, I need one to initially be created and all others to append to the text in that same one. The loop circles again and again so I cannot just put the initialization outside the loop I need to learn how to reference a form and how to check if one is already open or not. This does not compile: PrintViewForm P; if(P==null) { P=new PrintViewForm(); P.GetItFromFile(FileArr[k]); P.Show(); } else { P.GetItFromFile(FileArr[k]); }
Answers (1)