load variable

  • Thread starter Thread starter Eduardo Arévalo
  • Start date Start date
E

Eduardo Arévalo

Like load a value of a one variable in actual form of other form.?.

thank's

Eduardo
 
Hi Eduardo,
make the form which you want to get the variable from have a public
property that exposes the variable, you can then get it from the other form
i.e


class Form1 : Form
{
private int _myInternalNumber = 5;

public int TheNumber
{
get
{
return _myInternalNumber;
}
}
}

Then form2 would do something like:

Form1 f1 = new Form1();

int TheNumberFromForm1 = f1.TheNumber;


Hope that helps
Mark R Dawson
 
Thank's Mark.





Mark R. Dawson said:
Hi Eduardo,
make the form which you want to get the variable from have a public
property that exposes the variable, you can then get it from the other
form
i.e


class Form1 : Form
{
private int _myInternalNumber = 5;

public int TheNumber
{
get
{
return _myInternalNumber;
}
}
}

Then form2 would do something like:

Form1 f1 = new Form1();

int TheNumberFromForm1 = f1.TheNumber;


Hope that helps
Mark R Dawson
 
Back
Top