How to create Hyperlink in MessageBox.show?

user2046417 picture user2046417 · Feb 11, 2013 · Viewed 43.7k times · Source

I have tried creating a hyperlink in MessageBox in this way:

MessageBox.Show(
    "test message",
    "caption",
    MessageBoxButtons.YesNo,
    MessageBoxIcon.Information,
    MessageBoxDefaultButton.Button1,
    0,
    **"http://google.com"**,
    "Keyword"
);

Note: The Above code was actually "chosen as a answer" in an another question https://stackoverflow.com/a/1833877/2046417 ,but I don't know why its not working for me. I am getting error at keyword (Error 3 The * or -> operator must be applied to a pointer C:\Users\kiriti\Documents\Visual Studio 2010\Projects\TailorApplication_3\TailorApplication_3\Form1.cs 359 140 TailorApplication_3)

Answer

user2046417 picture user2046417 · Feb 11, 2013

I tried playing around with the code and found a solution to my own question.

if (MessageBox.Show(
        "test", "Visit", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk
    ) == DialogResult.Yes)
{
    System.Diagnostics.Process.Start("http://www.google.com");
}

Works great! :)