Jason Anderson

Jason Anderson

  • NA
  • 7
  • 45.5k

Why Are My Property Values Null?

Apr 28 2011 10:34 AM

I am trying to get a property value when I click on a button on my webform.  When I step through the struct, the property value is set properly.  When I try to get the value, it always equals null.  I want the value to be displayed in a label on the webform (lblOneStart.text).  Here is my code:

public class One
{
 public One()
 {
 }
 public struct NumOne
 {
  private string valueA;
  private string valueB;

  public string startOne
  {
   get{return valueA;}
   set{valueA=value;}
  }
  public string endOne
  {
   get{return valueB;}
   set{valueB=value;}
  }
 }
}
public class Two
{
 public Two()
 {
 }
 public void DoThis()
 {
  One.NumOne n = new One.NumOne();
  n.startOne = "A1";
  n.endOne = "B30";
 }
}
public void btnRead_Click(object sender, System.EventArgs e)

 One.NumOne n = new One.NumOne();
 Two t = new Two();
 t.DoThis();
 lblOneStart.Text = n.startOne;
 lblOneEnd.Text = n.endOne;
}

Thanks in advance for your help.  Jason


Answers (1)