You can provide help for message box in different ways. You can configure a MessageBox
to show a Help
button or not. Also you can configure MessageBox
in a way that when the user requests for help by click on Help button or by pressing F1, it show a CHM file or navigate to a URL or perform a custom action. Here are some examples in this topic.
In all below examples, the MessageBox
would be like this:
MessageBox.Show("Some Message", "Title", MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Question, MessageBoxDefaultButton.Button3, 0,
"help.chm", HelpNavigator.KeywordIndex, "SomeKeyword");
MessageBox.Show("Some Message", "Title", MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Question, MessageBoxDefaultButton.Button3, 0,
"help.chm", HelpNavigator.Topic, "/SomePath/SomePage.html");
MessageBox.Show("Some Message", "Title", MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Question, MessageBoxDefaultButton.Button3, 0,
"help.chm");
MessageBox.Show("Some Message", "Title", MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Question, MessageBoxDefaultButton.Button3, 0,
"http://example.com");
In this case you should handle HelpRequested
event of parent of MessageBox
and perform custom operation:
private void Form1_HelpRequested(object sender, HelpEventArgs hlpevent)
{
// Perform custom action, for example show a custom help form
var f = new Form();
f.ShowDialog();
}
Then you can show the MessageBox
with Help button:
MessageBox.Show("Some Message", "Title", MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Question, MessageBoxDefaultButton.Button3, 0, true);
Or show it without Help button:
MessageBox.Show("Some Message", "Title", MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Question, MessageBoxDefaultButton.Button3, 0, false);