the use of DialogResult question.
Posted on 2008-11-05
can you please explain the use of DialogResult in this code? I have two forms. Form1 opens Form2 as a modal dialog using a button. For that action, I used f2.ShowDialog(); when 'open' button is clicked on Form1.
Now, in Form2 when I click 'Save' button, the values in Form2 will be saved.
private void button1_Click(object sender, EventArgs e)
// Do somthing for saving result.
this.DialogResult = DialogResult.OK;
But, when I add the last line(this.DialogResult = DialogResult.OK; ), Form2 is closed. I don't understand the last line of code. I don't know how this line of code close Form2. What does 'DialogResult.OK' really mean in this code?