vb.net - do some action before displaying the message box, winforms -
i useme.cursor = cursors.waitcursor
for time taking functions hitting db.
now if exception occurs, i'll display error message as:msgbox(ex.message)
so before displaying message, need reset cursor default. there simple way @ in 1 place instead of writing in catch blocks.
is there way inherit messagebox class , override functions?
other wise need code in catch blocks or handle exceptions @ 1 place don't want modify whole application now.
thanks in advance.
i think can create common function this, accepts exception parameter , call function in every catch block.
try 'do code here catch ex exception showexception(ex) end try private sub showexception(ex exception) messagebox.show("an exception occured." + vbcrlf + ex.tostring()) me.cursor = cursors.default end sub
Comments
Post a Comment