G
Guest
I am making the transition from VB to C# and am stumped on a seemingly simple
task. I have created a class and defined a property using set/get. Now from
one of my forms I want to set the property to a value but I get a compile
error saying "An object reference is required for the nonstatic field,
method, or property 'PocketRigger.PRCalculations.LegLength1.get'" I don't
understand why it is using the get instead of the set. This is my class:
// internal fields
int m_iDistanceBetweenBeams;
double m_dLegLength1;
double m_dLegLength2;
//
// properties
//
public double LegLength1
{
get { return m_dLegLength1; }
set { m_dLegLength1=value; }
}
And this is how I am trying to set the value:
PRCalculations.LegLength1 = 1;
What am I going wrong? Thanks.
task. I have created a class and defined a property using set/get. Now from
one of my forms I want to set the property to a value but I get a compile
error saying "An object reference is required for the nonstatic field,
method, or property 'PocketRigger.PRCalculations.LegLength1.get'" I don't
understand why it is using the get instead of the set. This is my class:
// internal fields
int m_iDistanceBetweenBeams;
double m_dLegLength1;
double m_dLegLength2;
//
// properties
//
public double LegLength1
{
get { return m_dLegLength1; }
set { m_dLegLength1=value; }
}
And this is how I am trying to set the value:
PRCalculations.LegLength1 = 1;
What am I going wrong? Thanks.