title: C# class problem - object not being recognized
body: <p>I have run into a problem in this program, where I cant get my Calcpay method to output in the right spot, its outputting wrong. I want it to output when the <code>computepay</code> button is clicked, but its not recognizing the object there, when I put <code>textbox7</code> under <code>openToolStripMenuItem1_Click</code> to test it, it came out as 0 anyways.
  Thanks in advance for any help</p>
  
  <pre><code>    public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
          //opens about page
          private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
          {           
          }
          //closes program
          private void exitToolStripMenuItem1_Click(object sender, EventArgs e)
          {
              this.Close();
          }
          //reads in data from text file, assigns to textboxes.
          private void openToolStripMenuItem1_Click(object sender, EventArgs e)
          {
              double emphours;
              double hourpay;
              Stream myStream = null;
              OpenFileDialog openFileDialog1 = new OpenFileDialog();
              openFileDialog1.InitialDirectory = "c:\\";
              openFileDialog1.Filter = "text files (*.txt)|*txt";
              if (openFileDialog1.ShowDialog() == DialogResult.OK)
              {
                  if ((myStream = openFileDialog1.OpenFile()) != null)
                  {
                      StreamReader data = new StreamReader(myStream);
                      textBox1.Text = data.ReadLine();
                      textBox4.Text = data.ReadLine();
                      textBox2.Text = data.ReadLine();
                      textBox3.Text = data.ReadLine();
                      emphours = double.Parse(data.ReadLine());
                      hourpay = double.Parse(data.ReadLine());
                      Employee employ = new Employee(emphours, hourpay);
                      textBox5.Text = Convert.ToString(employ.EmpHours);
                      textBox6.Text = Convert.ToString(employ.EmpHourPay);
                  }
              }
          }
          // The CalcPay_Clickmethod
          //  display employee net pay
                              private void computepay_Click(object sender, EventArgs e)
          {
                       // need to get calcpay method to output here
                                  //textbox7.Text = xx  
          }
                  }
              }
  
          public class Employee
      {
  
          const int TimeAndAHalfMarker = 40;
          const double Federaltax = .20;
          const double Statetax = .075;
          const double TimeAndAHalf = 0.5;
          private double netpay, grossPay, stateTax, federalTax;
          public double EmpHours { get; private set; }
  
          public double EmpHourPay { get; private set; }
  
          public Employee(double emphours, double emphourpay)
          {
              EmpHours = emphours;
              EmpHourPay = emphourpay;
          }
  
          public double Calcpay(double emphours, double emphourpay)
          {
  
              EmpHours = emphours;
              EmpHourPay = emphourpay;
              if (EmpHours &gt; TimeAndAHalfMarker)
                  grossPay += (((EmpHours - TimeAndAHalfMarker) * EmpHourPay) * TimeAndAHalf);
              federalTax = grossPay * Federaltax;
              stateTax = grossPay * Statetax;
              netpay = grossPay - stateTax - federalTax;
  
              return netpay;
          }
      }
  
  
  }
  </code></pre>
  
  <p>a sample text file is:</p>
  
  <blockquote>
    <p>Mary R. Programmer</p>
    
    <p>1237</p>
    
    <p>17 North Elm Avenue</p>
    
    <p>789-1000</p>
    
    <p>40.0</p>
    
    <p>15.00</p>
  </blockquote>