留言框 [英] message Box

查看:88
本文介绍了留言框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我按下{Exit}按钮(在任何程序中)时,我想显示一个消息框,其中包括(是")按钮和问号.您能给我提供执行此操作的代码吗? :)

I Want To Make A Message Box When I press {Exit} Button (In Any programe) include (Yes No) Buttons And Question Mark Can You give me the code to do That ? :)

推荐答案

public static void Main(string[] args) {
    // Starts the application.
    Application.Run(new Form1());
 }
 protected void button1_Click(object sender, System.EventArgs e) {
    // Populates a list box with three numbers.
    int i = 3;
    for(int j=1; j<=i; j++) {
       listBox1.Items.Add(j);
    }
    /* Determines whether the user wants to exit the application.
     * If not, adds another number to the list box. */
    while (MessageBox.Show("Exit application?", "", MessageBoxButtons.YesNo) ==
       DialogResult.No) {
       // Increments the counter ands add the number to the list box.
       i++;
       listBox1.Items.Add(i);
    }
    // The user wants to exit the application. Close everything down.
    Application.Exit();
 }


您正在开发Web应用程序还是Windows应用程序?

如果是Windows,请使用以下命令:
Are you developing web application or windows application?

If windows, then use this:
MessageBox.Show("Your Message","Your Caption", MessageBoxButtons.YesNo, MessageBoxIcon.Question);



如果是Web应用程序,则需要编写Javascript来显示消息框.



If web application, you need to write javascripts for displaying messagebox.


您的意思是说您患有某种身体障碍,因此无法使用Google?这是搜索词组"C#messagebox"返回的570多个结果中的第一个.

http://msdn.microsoft.com/zh-我们/library/system.windows.forms.messagebox%28VS.71%29.aspx [
You mean you have some sort of physical impairment that prevents you from using google? Here''s the first of over 570 THOUSAND results returned with the search phrase "C# messagebox".

http://msdn.microsoft.com/en-us/library/system.windows.forms.messagebox%28VS.71%29.aspx[^]


这篇关于留言框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆