implemented try...catch handling in buttons

implemented try...catch loops in all button click methods to ensure
proper operations.