How to monitor the change of a variable's value?

  • Thread starter Thread starter nopatch4humancruelty
  • Start date Start date
N

nopatch4humancruelty

Guest
Hi everybody,

I've a C# class who contains a integer variable:

public class AClassController
{
public static int x;
...
...

public void methodWhoChangeXValue()
{
...
x = //newIntValue;
...
}
}

Furthermore, I've a Form class who contains a multiline TextBox who must print the x value everytime it's value change, after a button click:

public partial class AForm : Form
{
public AForm()
{
InitializeComponent();
...
}
...

private void button_Click(object sender, EventArgs e)
{
//Everytime the x value change, there must be a new line in
the multiline textbox
textBoxMultiline.AppendText(AClassController.x.ToString()
+ Environment.NewLine);
}


How I can add a new line in the textbox when the methodWhoChangeXValue() changes the X value? Note: the methodWhoChangeXValue() is called in loop in a AClassController's method, so the value of x often changes.


Can you help me?


Thank you

Continue reading...
 
Back
Top