add try to catch statements in frmMain