I'm writing a code to build a advance calculator, I got everything BESIDES putting a message error that says: "Cannot divide by zero." in the dividebutton I just have a really hard time coding a message error...

Thanks!

    MsgBox("Cannot divide by zero", MsgBoxStyle.Critical)

Hi,

You can find an example about Catch Exception, Click Here

Hope it helps.

Grtz,

Or you can test the operands before you do the divide to see if the denominator is zero.

commented: Life can be really simple. +14

I got it now, Thanks Luc001!

Hi Jockster,

Glad to help.
Mark your thread as resolved, so it can help others.

Grtz,