Z
Z
Zaic 10242014-01-07 18:59:00
Programming
Zaic 1024, 2014-01-07 18:59:00

How to add custom buttons to a MessageBox in C#?

There is a need to make 4 buttons when calling the MessageBox.Show(...) method. The name and the text displayed on them must be set by yourself. And call exactly the MessageBox.Show(...) method, and not create a new form with 4 buttons. (Visual Studio 2012)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavlo Barmak, 2014-01-07
@kynisa

Impossible. There are two alternatives:
1) MessageBoxButtons . You can set 6 button options that will be with MessageBox.Show(), and use them. But there will be a maximum of three buttons, and the text will be standard.
2) Use CustomMessageBox :

var myMessageBox = new CustomMessageBox();
myMessageBox.ShowDialog();
In the second option, you can also create your own class - a Form successor with everything you need, ShowDialog() should also work for it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question