本文介绍了C#如何暂停执行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

情况就是这样.
我有一个表格,上面有一个按钮.当用户单击我要打开新表单的按钮时,用户从该表单中选择某项内容,接受选择,然后使用先前选择的项目继续执行主表单.

我在想线程,但是怎么想呢?

The situation is this.
I have a form and on it a button. When the user clicks the button I want a new form to open, the user to select something from that form,accept the selection, and then the main form to continue execution using the item previously selected.

I''m thinking threads, but how?

推荐答案

private void ShowMyDialog()
{
  using (MyDialog dialog = new MyDialog())
  {
    if (dialog.ShowDialog() == DialogResult.OK)
    {
      MessageBox.Show(dialog.UserEnteredValue);
    }
  }
}


这篇关于C#如何暂停执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 00:57