I have created a messagebox which returns DialogResult. Now I added checkbox on it and want to know if it is checked or not. So what should I return? The simple way I thought is to create new enum which will have all the values from DialogResult plus a value to indicate checkbox status
public enum MyDlgResult
{
NONE = DialogResult.NONE,
OK = DialogResult.OK ........................,
CHKBOXCHECKED = 8
}
…and returning this enum MyDlgResult.
But is this correct approach? Because I have to add value in this enum every time a new functionality is added to my messagebox.
Better way to do this if any.
Thank You.
Just add Property to that message box, which will be a proxy to Checked property of CheckBox and on OK result form message box check that new Property.
Property to add
And final code like this