it will be very easy to answer this question , if you post you code here.
just receive input and check whether user wanna continue or not (i think if will help you).
if the input is for yes then continue i.e. call the function main();
I have the C++ 2003 standard to hand which states in section 3.6.1, paragraph 3, "The function main shall not be used within a program."
So, do not call main; it's incorrect C++, as well as a bad idea (look up "stack frame" to get an idea of what can go horribly wrong, with "stack overflow") and demonstrates to someone else reading the code that the programmer appears to have been taught BASIC back in the early eighties and now just tries to write BASIC programmes in whatever language they're using.
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 ...