按下按钮后继续编码

时间:2014-02-05 12:34:21

标签: c# winforms events button ini

Textbox中提供的信息和代码应停止并等待用户按下Button,以便他“显示”他已阅读信息......

在此之后,代码应该向前运行并在下一个循环中再次等待

(我查找事件等,但我找不到任何解决方案)

  public void Auslesen(object e, EventArgs myevent)
    {

        StringBuilder strbuildsection = new StringBuilder();
        StringBuilder strbuildbetreff = new StringBuilder();
        StringBuilder strbuildinhalt = new StringBuilder();
        StringBuilder strbuilduser = new StringBuilder(System.Environment.UserName);
        StringBuilder strbuildusercheck = new StringBuilder();


        foreach (string Ccat in this.ini.IniGetCategories())
        {
            string readval = ini.IniReadValue(Ccat, "Read");
            string usercheckvar = (this.ini.IniReadValue(Ccat, "SpecifyUser"));
            string user = System.Environment.UserName;

            if (readval == "0")
            {
                if (usercheckvar == user || usercheckvar.Equals("All"))
                {
                    strbuildsection.Append(Ccat + Environment.NewLine);

                    foreach (string cat in this.ini.IniGetKeys(Ccat))
                    {
                        strbuildinhalt.Clear();
                        strbuildusercheck.Clear();
                        strbuildbetreff.Clear();

                        strbuildbetreff.Append(this.ini.IniReadValue(Ccat, "Betreff") + Environment.NewLine);
                        strbuildinhalt.Append(this.ini.IniReadValue(Ccat, "Inhalt") + Environment.NewLine);
                    }

                    textBox1.AppendText(strbuildsection.ToString() + strbuildbetreff.ToString() + strbuildinhalt.ToString() + strbuildusercheck.ToString() + Environment.NewLine);
                        strbuildsection.Clear();

                    //
                    //
                    //
                }
            }
        }

    }

1 个答案:

答案 0 :(得分:0)

如果您希望程序停止以允许用户确认事件,请使用消息框。

MessageBox.Show("Your message here.");

用户必须在程序继续之前单击“确定”按钮。

以下是MessageBox上的MSDN文档。

http://msdn.microsoft.com/en-us/library/windows/desktop/ms645505(v=vs.85).aspx