title: How to update item from listview in main form to textbox in second form in windows form application in c#?
body: <p>I create a program for an accountant. I have buttons for add product, delete product, add quantity of products, sell product and profit(count profit from all products in list) and listview for products with columns product, quantity, 
  purchase price and profit. I have problem with button "add quantity of products" my idea is, when I select product in listview and than click on the button "add quantity of products" I want to open a new window (new form) and to pass all the values from selected item from listview to second form, make mathematical calculations with that values and then pass that new values to selected item in first form ie to update select item in list view. How can I resolve that?
  This is my code:</p>
  
  <p><strong>Form1:</strong></p>
  
  <pre><code>public int Index;
  
      private void button3_Click(object sender, EventArgs e)
      {
          Form3 form3 = new Form3();
          form3.Show();
          form3.Hide();
  
          if (listView1.SelectedItems.Count &gt; 0)
          {
              this.listView1.Items[0].Focused = true;
              this.listView1.Items[0].Selected = true;
              this.Index = listView1.FocusedItem.Index;
              ListViewItem selectedItem = listView1.SelectedItems[0];
  
              form3.GetData(listView1.Items[listView1.FocusedItem.Index].SubItems[0].Text, listView1.Items[listView1.FocusedItem.Index].SubItems[1].Text,
                            listView1.Items[listView1.FocusedItem.Index].SubItems[2].Text, listView1.Items[listView1.FocusedItem.Index].SubItems[3].Text);
              DialogResult ans = form3.ShowDialog();
              if (ans == DialogResult.OK)
              {
                  listView1.FocusedItem.SubItems[0].Text = form3.Prozz;
                  listView1.FocusedItem.SubItems[1].Text = form3.Kolii;
                  listView1.FocusedItem.SubItems[2].Text = form3.Cenaa;
                  listView1.FocusedItem.SubItems[3].Text = form3.Proff;
              }
          }
      }
  </code></pre>
  
  <p><strong>Form2:</strong></p>
  
  <pre><code>  public string Prozz { get; set; }
      public string Kolii { get; set; }
      public string Cenaa { get; set; }
      public string Proff { get; set; }
  
      public Form3()
      {
          InitializeComponent();
      }
      public void GetData(string Proi, string Kol, string Cena, string Profit)
      {
          textBox1.Text = Kol;
          textBox2.Text = Cena;
          textBox3.Text = Profit;
          textBox6.Text = Proi;
      }
      public void SetData(string Proz, string Kol, string NabCena, string Prof)
      {
          int x = int.Parse(Kol);
          double y = double.Parse(NabCena);
          double z = double.Parse(Prof);
          int a = int.Parse(textBox4.Text);
          double b = double.Parse(textBox5.Text);
  
          int Kolicina = x + a;
          double sumNabavnaCena = (x * y + a * b) / (x + a);
          double Profit = z - Kolicina * sumNabavnaCena;
  
          Prozz = Convert.ToString(Proz);
          Kolii = Convert.ToString(Kolicina);
          Cenaa = Convert.ToString(sumNabavnaCena);
          Proff = Convert.ToString(Profit);
      }
      private void button1_Click(object sender, EventArgs e)
      {
          SetData(textBox6.Text, textBox1.Text, textBox2.Text, textBox3.Text);
          this.button1.Text = "OK";
          this.button1.DialogResult = DialogResult.OK;
  
          this.Close();
      }
  </code></pre>