How do you make a form close by itself?
-
I'm trying to make a popup window, that closes after it executes several functions but it doesn't work because the form stays open. I tried 2 ways, __gc class test1: public Form { public: test1() { Close(); } };//stays open __gc class test: public Form { public: __delegate void delegate(); void close(){Close();} test() { delegate* pDelegate = new delegate(this, &test::close); pDelegate->Invoke(); } };//stays open -------------------------- One problem with the programmer's mentality is insecurity. This goes deep. An insulting college litany says that failed mathematicians become computer programmers. They are also ridiculed for being nerdy losers, for being too fat or too skinny, and for having few social skills. Most programmers can be spotted easily in a crowd. Nobody really wants to hang out with them. Put thousands of these people in one company and if you can get them to work, you become a billiona
-
I'm trying to make a popup window, that closes after it executes several functions but it doesn't work because the form stays open. I tried 2 ways, __gc class test1: public Form { public: test1() { Close(); } };//stays open __gc class test: public Form { public: __delegate void delegate(); void close(){Close();} test() { delegate* pDelegate = new delegate(this, &test::close); pDelegate->Invoke(); } };//stays open -------------------------- One problem with the programmer's mentality is insecurity. This goes deep. An insulting college litany says that failed mathematicians become computer programmers. They are also ridiculed for being nerdy losers, for being too fat or too skinny, and for having few social skills. Most programmers can be spotted easily in a crowd. Nobody really wants to hang out with them. Put thousands of these people in one company and if you can get them to work, you become a billiona
I'm just recovering from a fresh install so I don't have the framework installed yet; but what happens if you call Close on the test object outside of the constructor? HTH, James Sonork ID: 100.11138 - Hasaki "My words but a whisper -- your deafness a SHOUT. I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
-
I'm just recovering from a fresh install so I don't have the framework installed yet; but what happens if you call Close on the test object outside of the constructor? HTH, James Sonork ID: 100.11138 - Hasaki "My words but a whisper -- your deafness a SHOUT. I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
when I try calling it from outside the constructor, it won't close. What I'm going to try doing is A), create the window in a new background thread and have the foreground thread close it in 3 seconds or B)have the constructor of the new form take a variable.... incomplete thought as of now, will try A) 1st =) ------ The background worker thread method worked __gc class heh: public Form { public: heh() { Size = System::Drawing::Size(300,300); Text = "I Should be gone soon"; } }; __gc class test: public Form { heh* mm; void popup(){ mm->ShowDialog(); } public: test() { Text = "Base Form"; mm = new heh(); Thread* worker = new Thread(new ThreadStart(this, &test::popup)); worker->IsBackground = true; worker->Start(); Thread::Sleep(100); mm->Close(); worker->Abort(); } }; -------------------------- One problem with the programmer's mentality is insecurity. This goes deep. An insulting college litany says that failed mathematicians become computer programmers. They are also ridiculed for being nerdy losers, for being too fat or too skinny, and for having few social skills. Most programmers can be spotted easily in a crowd. Nobody really wants to hang out with them. Put thousands of these people in one company and if you can get them to work, you become a billiona