我在第一个问题上得到了很大的帮助,希望有人会告诉我或者提前找一个关于这个主题的问题。

我希望链接不同的表单,例如我点击第一个按钮,然后打开第二个。基本上我会为手机功能设置菜单,如SMS,CALL等。所以我想要如果我点击通话,则会打开一个新表格,要求拨打号码等。

有帮助吗?

解决方案

void SomeInitializationFunction() {
      button.Click += new System.EventHandler(buttonClick);
}

private void buttonClick(object sender, System.EventArgs e)
{
    using(GetNumberForm getNumberForm = new GetNumberForm())
    {
        if(DialogResult.OK == getNumberForm.ShowDialog())
        {
            string phoneNumber = getNumberForm.PhoneNumber;
            // do something with the user input.
        }
    }
}

其他提示

var otherForm = new Form2();
otherForm.ShowDialog(); // To show a modal dialog, or...
otherForm.Show();  // To show it as a non-modal window
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top