if I start my C# Windows Form Application, buttons hangs, because it is endless cycle. I want to see the change of variable value from button2 click into infinite loop of button1 through the global variable
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace XX_5
{
public partial class Form1 : Form
{
private int g;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int i = 0;
for (;;)
{
textBox1.AppendText("ID: [" + i++ + "] Variable value: [" + g + "]\n");
}
}
private void button2_Click(object sender, EventArgs e)
{
g = 1;
}
}
}