Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clickable URL in a Winform Message Box?

I want to display a link to help in a message box. By default the text is displayed as a non-selectable string.

like image 423
Jeff Avatar asked Dec 02 '09 15:12

Jeff


People also ask

How do you add a link to a message box?

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).

What is link in C#?

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.

What is Message Box property in C#?

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.


1 Answers

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.

like image 116
schar Avatar answered Nov 10 '22 21:11

schar