WebNov 11, 2008 · using (FormOptions formOptions = new FormOptions ()) { // passing this in ShowDialog will set the .Owner // property of the child form formOptions.ShowDialog (this); } In the child form, use this code to pass a value back to the parent: ParentForm parent = (ParentForm)this.Owner; parent.NotifyMe ("whatever"); WebThe DialogResult returned by the ShowDialog () method allows you to take the appropriate actions... So for example using (Form1 form = new Form1 ()) { DialogResult dr = form.ShowDialog (); if (dr == DialogResult.OK) { string custName = form.CustomerName; SaveToFile (custName); } }
Have ShowDialog Return String? - social.msdn.microsoft.com
http://duoduokou.com/csharp/50847104629217775787.html WebJun 8, 2014 · The call to form.Show () returns immediately. You user will have no chance to do anything before the call returns. If you want to wait until the user presses a button like OK or Cancel you need to call form.ShowDialog () that will block the execution of the remainder of your code until the closing of the form. good video bitrate for obs
[Solved] C# how to return to form using mainform_formclosing …
WebSep 19, 2024 · public void SaveToFile () { SaveFileDialog saveToFileDialog = new SaveFileDialog () { Filter = "Comma Separated Values (*.csv) *.csv Text File (*.txt) *.txt " , FilterIndex = 0 , RestoreDirectory = true }; if (saveToFileDialog.ShowDialog () == DialogResult.OK) //After User Opens the DialogBox syste prepares to create a new file { … WebNov 15, 2024 · If you don't want to expose a property, and you want to make the usage a little more explicit, you can overload ShowDialog: public DialogResult ShowDialog (out MyObject result) { DialogResult dr = ShowDialog (); result = (dr == DialogResult.Cancel) ? null : MyObjectInstance; return dr; } Share Improve this answer Follow WebJan 31, 2024 · Form1 C# public partial class Form1 : Form { private void button1_Click ( object sender, EventArgs e) { Form2 objForm2 = new Form2 (); objForm2.ShowDialog (); this .textBox1.Text = objForm2.SumValue; // read the value from form2 } Posted 26-Sep-16 23:52pm Karthik_Mahalingam Comments MR.alaa 27-Sep-16 6:17am good video baby monitor