title: How can I pass a value from child form to parent form and back?
body: <p>I have a parent form first.cs like this</p>
  
  <pre><code>public partial class first : Form
  {
      public Graph graphi { get; }
      Graph g = new Graph();
      string s1 = null;
  
      private void button1_Click(object sender, EventArgs e)
      {
          Stream myStream = null;
  
          var parser = new Notation3Parser();
          var graph = new Graph();
          OpenFileDialog openFileDialog1 = new OpenFileDialog();
          openFileDialog1.Filter = "RDF files (*.n3)|*.n3";
          openFileDialog1.FilterIndex = 1;
          openFileDialog1.RestoreDirectory = true;
          openFileDialog1.Multiselect = false;
  
          if (openFileDialog1.ShowDialog() == DialogResult.OK)
          {
              try
              {
                  if ((myStream = openFileDialog1.OpenFile()) != null)
                  {
                      using (myStream)
                      {
                          string s = openFileDialog1.FileName.ToString();
  
                          string w = Directory.GetCurrentDirectory().ToString();
  
                          string Fname = openFileDialog1.SafeFileName.ToString();
                          File.Copy(s, Path.Combine(w, Fname), true);
  
                          // Insert code to read the stream here.
                          Win32.AllocConsole();
                          s1 = Path.Combine(w, Fname);
  
                          showPath.Text = s1;
                          String parentvalueadress = this.s1;
                          showPath.Visible = true;
                          insertNodeButton.Visible = true;
                          delBut.Visible = true;
  
  
                          showNodes showNodes1 = new showNodes(s1);
                          g = showNodes1.returngraph();
  
  
  
                          Console.Read();
                          Win32.FreeConsole();
  
  
                          this.Show();
                      }
                  }
              }
              catch (Exception ex)
              {
                  MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
              }
          }
      }
  
      private void insertNodeButton_Click(object sender, EventArgs e)
      {
          addTriple a1 = new addTriple();
          a1.BringToFront();
          a1.ShowDialog();
          g.SaveToFile(this.s1);
      }
  
      private void button3_Click(object sender, EventArgs e)
      {
          delete a1 = new delete();
          a1.BringToFront();
          a1.ShowDialog();
      }
  }
  </code></pre>
  
  <p>in insertNodeButton_Click method I want to pass a value of graph g to the child form that it is code  is like this:</p>
  
  <pre><code>public partial class addTriple : Form
  {
      Graph gr;
      String childvalueadress;
  
      private void addTriple_Load(object sender, EventArgs e)
      {
          var parser = new Notation3Parser();
          var graph = new Graph();    
          gr = graph;
          parser.Load(graph, childvalueadress);    
      }
  
      private void subComboBox_SelectedIndexChanged(object sender, EventArgs e)
      {
          if (subComboBox.SelectedItem.ToString() == "URI")
          {
              subUriTB.Visible = true;
              label1.Visible = true;
          }
          else
          {
              subUriTB.Visible = false;
              label1.Visible = false;
          }
      }
  
      private void objComboBox_SelectedIndexChanged(object sender, EventArgs e)
      {
          if ((objComboBox.SelectedItem.ToString() == "URI") || (objComboBox.SelectedItem.ToString() == "Literal"))
          {
              objUriTB.Visible = true;
              label1.Visible = true;
          }
          else
          {
              objUriTB.Visible = false;
              label1.Visible = false;
          }
      }
  
      private void addTripleButton_Click(object sender, EventArgs e)
      {
          if (subComboBox.Text.ToString() == "select" || objComboBox.Text.ToString() == "select")
              MessageBox.Show("please select node types");
  
          else if ((subComboBox.SelectedItem.ToString() == "URI") &amp;&amp; (subUriTB.Text.ToString() == ""))
              MessageBox.Show("please fill text box for URI");
          else if ((preUriTB.Text.ToString() == ""))
              MessageBox.Show("please fill text box for URI");
          else if ((objUriTB.Text.ToString() == "") &amp;&amp; ((objComboBox.SelectedItem.ToString() == "URI") || (objComboBox.SelectedItem.ToString() == "Literal")))
              MessageBox.Show("please fill text box for object name");
          else if ((objComboBox.SelectedItem.ToString() == "URI") &amp;&amp; (objUriTB.Text.ToString() == ""))
              MessageBox.Show("please fill text box for URI");
          try
          {
              if ((subComboBox.Text.ToString() == "URI") &amp;&amp; (objComboBox.Text.ToString() == "URI"))
                  addUUU(subUriTB.Text.ToString(), preUriTB.Text.ToString(), objUriTB.Text.ToString(), gr);
              else if ((subComboBox.Text.ToString() == "URI") &amp;&amp; (objComboBox.Text.ToString() == "Literal"))
                  addUUL(subUriTB.Text.ToString(), preUriTB.Text.ToString(), objUriTB.Text.ToString(), gr);
              else if ((subComboBox.Text.ToString() == "Blank") &amp;&amp; (objComboBox.Text.ToString() == "Literal"))
                  addBUL(preUriTB.Text.ToString(), objUriTB.Text.ToString(), gr);
              else if ((subComboBox.Text.ToString() == "URI") &amp;&amp; (objComboBox.Text.ToString() == "Blank"))
                  addUUB(subUriTB.Text.ToString(), preUriTB.Text.ToString(), gr);
          }
          catch
          {
              MessageBox.Show("please correct the uri");
          }
          gr.SaveToFile("c:\\n.n3");
      }
  }
  </code></pre>
  
  <p>and work with this value in this child form and then pass it to the parent form first.cs</p>
  
  <p>how can i do that?</p>