• MessageBox


     private void validateUserEntry2()
        {

            // 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 = "No Server Name Specified";
                MessageBoxButtons buttons = MessageBoxButtons.YesNo;
                DialogResult result;

                // Displays the MessageBox.

                result = MessageBox.Show(this, message, caption, buttons,
                    MessageBoxIcon.Question, MessageBoxDefaultButton.Button1,
                    MessageBoxOptions.RightAlign);

                if(result == DialogResult.Yes)
                {

                    // Closes the parent form.

                    this.Close();

                }

            }





    C#]
    protected void button1_Click(object sender, System.EventArgs e) {
       if(textBox1.Text == "") {
          MessageBox.Show("You must enter a name.", "Name Entry Error",
             MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
       }
       else {
          // Code to act on the data entered would go here.
       }
    }
  • 相关阅读:
    ASP.NET中常用的附件上传下载
    C#中导出Excel的常用方式
    ASP.NET中AjaxPro.dll的简单应用
    在ASP.NET中使用FusionCharts图表
    ASP.NET中使用MagicAjax.dll
    FusionCharts图表导出
    C#中经常注入的一些Javascript代码
    CodeSmith3.2(.net2.0)教程
    您未必知道的Css技巧
    Web Service简介
  • 原文地址:https://www.cnblogs.com/VirtualMJ/p/MessageBox.html
Copyright © 2020-2023  润新知