Custom dialog box in C#?

后端 未结 5 2057
执笔经年
执笔经年 2021-02-20 17:19

I have a button that when clicked, a dialog box opens up with various controls on it such as radio buttons and text boxes. If OK then the values in that dialog box is passed ba

5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-20 17:58

    Somewhere in the code that disposes of the dialog you can also explicitly set the result. For example, you could put the following code in a button click event handler.

    OnOKButton_Click(object sender, EventArgs e)
    {
        this.DialogResult = DialogResult.OK;
        this.Dispose();
    }
    

提交回复
热议问题