Yeah. This was what I was wondering. Because I am initializing arrays using the new function, I was wondering if there was any way that I could catch a force close (clicking the X or using end task) so I could delete  the array.
Or maybe the array is automatically cleared from memory when the application closes :S I'm not too sure.
> ...maybe the array is automatically cleared from memory when the application closes...
right, provided your program is running under an os ( like unix, windows, linux ... ) which gives a separate virtual address space for each process. when a process terminates, all the resources it owns are reclaimed by the system; and its private memory would be deallocated.
be sure to disable or change the default close behavior... In java at least close is defaulted to do nothing so you have to set it yourself... I've never built a GUI in C++ before so I wouldn't know where to begin, but likely the pitfalls will be similar! Overload or override!
I see that the function runs when the window is about to close on itself. but is there a way or function to execute a command when the user actually clicks on the close button? or when the program is forcefully closed (let' s say when the PC is going to be turned off)? i have googled around but can't get any leads to this function, if there is any.
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...