I am creating an application that shows some alerts. With MessageBox.Show its ok, but its ugly for this project. Its a Metro like app, so we created a Metro-like MessageBox.
Our custom MessageBox is a grid that changes its visibility when we need it. The issue is that a real MessageBox, stops the execution util the user clicks its "ok".
So, how can I simulare this behavior?
Make your custom messagebox a form. Then you can call customMessageBoxFormInstance.ShowDialog().. which blocks exactly the same as a messagebox would.
This is what you would do:
MessageBox. Perhaps you can move your grid into it.DialogResult property set to OK.Use this wherever you want your alert to show up:
if (customMessageBoxInstance.ShowDialog() == DialogResult.OK) {
// they clicked okay..
}
It will block exactly as you expect a MessageBox to do..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With