There are 2 forms.
On 1 form there is a list of data and a couple of buttons, if I press the edit button, then 2 form comes out, where I enter some data and then click OK.
The question is how when you click Ok close 2 form?
There are 2 forms.
On 1 form there is a list of data and a couple of buttons, if I press the edit button, then 2 form comes out, where I enter some data and then click OK.
The question is how when you click Ok close 2 form?
Open through dialogue
using (MyForm fMyForm = new MyForm()) { if (fMyForm.ShowDialog() == DialogResult.OK) { .... } } and in the second form, when you press a button, you call
this.DialogResult = DialogResult.OK; this.Close(); dr.ToString() == "OK" ? Why not dr == DialogResult.OK ? or generally fMyForm.ShowDialog() == DialogResult.OK . fMyForm.ShowDialog() == DialogResult.OK ? - kodvswitch - LamerXaKerWPF Solution
Call the second form
MyForm form = new MyForm(); form.ShowDialog(); if (form.DialogResult == true) { ... } In the called form when you click "OK"
this.DialogResult = true; Close(); For the Cancel button
Close(); Source: https://ru.stackoverflow.com/questions/509556/
All Articles