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...


Recommended Answers

All 5 Replies

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


You can find an example about Catch Exception, Click Here

Hope it helps.


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.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.