private void validateUserEntry()
{    // Checks the value of the text.    if(serverName.Text.Length == 0)
    {        // Initializes the variables to pass to the MessageBox.Show method.        string message = "You did not enter a server name. Cancel this operation?";
                    string caption = "Error Detected in Input";
        MessageBoxButtons buttons = MessageBoxButtons.YesNo;
        DialogResult result;        // Displays the MessageBox.        result = MessageBox.Show(message, caption, buttons);        if(result == DialogResult.Yes)
        {            // Closes the parent form.            this.Close();        }    }}
这种问题请先查一下帮助好吗?

解决方案 »

  1.   

    楼上的是winform的,如果是web的,直接一个confirm就OK了
      

  2.   

    if (MessageBox.Show("123", "333", MessageBoxButtons.OKCancel).ToString() == "OK")
                {            }
      

  3.   

    我的是web,messagebox我会写啊,怪我没说明白
    请问songle912(依然零分的我依然零分) ,confirm怎么写啊,帮助我看了thisXDocument.UI.<b>Confirm</b>("Do you wish to continue?", XdConfirmButtons.xdYesNo);这个好像是客户端脚本,怎么用也没看明白
      

  4.   

    Microsoft.Office.Interop.InfoPath命名空间不存在,我想添加引用都没有
      

  5.   

    <a href="javascript:if(confirm("确实要删除吗?")location="boos.asp?&areyou=删除&page=1"">删除</a>
      

  6.   

    这种方法不是新建页面..orz,你试试就知道了~
      

  7.   

    <asp:Button ID="ButtonDel" runat="server" CssClass="button" Text="削除" OnClick="ButtonDel_Click" OnClientClick="return confirm('delete?')" CausesValidation="False" />web的就是这个了。