I want to display a link to help in a message box. By default the text is displayed as a non-selectable string.
MsgBox does not allow hyperlinks, just plain text. Thus, here is a workaround that should work alright. Make the Label blue ( ForeColor ) and underlined ( Font ) so it looks like a typical hyperlink. Specify the cursor file for the Label's MouseIcon image (if you have one).
The Links property a type of LinkCollection represents all the hyperlinks available in a LinkLabel control. The Add method of LinkColleciton is used to add a link to the collection. The Remove and RemoveAt methods are used to remove a link from the LinkCollection.
MessageBox is a class in C# and Show is a method that displays a message in a small window in the center of the Form. MessageBox is used to provide confirmations of a task being done or to provide warnings before a task is done. Create a Windows Forms app in Visual Studio and add a button on it.
One option is display the url in the message box, along with a message and provide the help button that takes you to that url:
MessageBox.Show( "test message", "caption", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, 0, '0 is default otherwise use MessageBoxOptions Enum "http://google.com", "keyword")
Important to note this code cannot be in the load event of the form, the Help button will not open the link.
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