title: Getting TextBox values from another class
body: <p>Got still no solution after over 5 hours of searching and trying...
  I've got 2 classes (lets call them Form1 and Form2). Form 1 has  two TextBoxes with values and a button. When I trigger this button, Form2 shall be opened and calculate something with the values which are written in the TextBoxes of Form1.</p>
  
  <p>Here is my code (if you need it):</p>
  
  <p>Form1:</p>
  
  <pre><code>namespace Darlehensrechner
  {
  /// &lt;summary&gt;
  /// Interaction logic for Annuitätendarlehen.xaml
  /// &lt;/summary&gt;
  public partial class Annuitätendarlehen : Window
  {
  
      public Annuitätendarlehen()
      {
          InitializeComponent();
      }
  
      public void berechnen2_Click(object sender, RoutedEventArgs e)
      {
          double zins = 0.03;
          double ZwErg1 = 0;
          double ZwErg2 = 0;
          double ZwErg3 = 0;
          double gSumme = 0;
  
          int monate;
          monate = Convert.ToInt32(monate2.Text);
          monate = int.Parse(monate2.Text);
  
          int betrag;
          betrag = Convert.ToInt32(betrag2);
          betrag = int.Parse(betrag2.Text);
  
          Annuitätenrechner annuitätenrechner = new Annuitätenrechner();
          //AnRe.AnRechner();
      }
  }
  }
  </code></pre>
  
  <p>Form2:</p>
  
  <pre><code>namespace Darlehensrechner
  {
  class Annuitätenrechner : Annuitätendarlehen
  {
       Annuitätendarlehen annuitätendarlehen = new Annuitätendarlehen();
  
      public void AnRechner(int monate, int betrag)
      {
          double zins = 0.03;
          double ZwErg1 = 0;
          double ZwErg2 = 0;
          double ZwErg3 = 0;
          double gSumme = 0;
  
  
          ZwErg1 = Math.Pow((1 + zins), monate * zins); //(1 + zins)^monate * zins / (1 + zins) ^ monate - 1;
          ZwErg2 = Math.Pow((1 + zins), monate - 1);
          ZwErg3 = ZwErg1 / ZwErg2;
          gSumme = ZwErg3 * betrag;
  
          rechnung2.Text = ZwErg1 + "   = Part 1: (1 + zins^monate * zins)" + Environment.NewLine +
              ZwErg2 + "   = Part 2: (1 + zins) ^ monate - 1" + Environment.NewLine +
              ZwErg3 + "   = Part 1 - Part 2";
  
          summeAn.Content = gSumme.ToString("0.00");
      }
  }
  }
  </code></pre>