D
Dan
I am declaring a property in a form - simplified example below.
public class frmMain : System.Windows.Forms.Form
{
private int x;
public int X
{
get
{
return x;
}
set
{
x = value;
}
}
// etc
I am then trying to access that property from another form on a button
click:
frmMain.X = "hello world";
However I get the following compiler error;
"An object reference is required for the nonstatic field, method, or
property "
Does anyone have any suggestion in how to fix.
Thanks in Advance
Dan
public class frmMain : System.Windows.Forms.Form
{
private int x;
public int X
{
get
{
return x;
}
set
{
x = value;
}
}
// etc
I am then trying to access that property from another form on a button
click:
frmMain.X = "hello world";
However I get the following compiler error;
"An object reference is required for the nonstatic field, method, or
property "
Does anyone have any suggestion in how to fix.
Thanks in Advance
Dan