문제

나는 나의 첫 번째 질문에서 큰 도움을 받았다.

첫 번째 버튼을 클릭하는 것처럼 다른 양식을 연결하고 싶습니다. 두 번째.

도움이 되었습니까?

해결책

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