How to create Hyperlink in MessageBox.show? [duplicate]

百般思念 提交于 2019-12-06 17:02:21

问题


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)


回答1:


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! :)




回答2:


The example given is for VB, if you remove the ** from the URL it will show the message box and take you to that URL when the help button is clicked.

For more information on the parameters of this call, see:

http://msdn.microsoft.com/en-us/library/ww6cfk80.aspx



来源:https://stackoverflow.com/questions/14819426/how-to-create-hyperlink-in-messagebox-show

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!