MFC program seems to always report the following error when I click the 'OK' button to exit the program:

Run-Time check failure #2 - stack around the varible 'dlg' was currupted

Can anyone explain this? if i click continue, then it just closes and returns me back to my development window....

however there is a yellow arror when the error occurs...

if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
	}

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}

yellow arrow always points to the clase '}' in this code snippet, any ideas?

your program has corrupted the stack someplace -- most likely buffer overflow or possibly use of uninitialized pointers. Its impossible to diagnose without seeing the entire program. I would probably start debugging by commenting out huge blocks of code until the problem goes away. Then you will know approximately where the problem is.