I want to show how many times I open and close the valve in the text box in the application I control, but I can only see the result when the process is finished, I cannot see it in real time.
private void button6_Click(object sender, EventArgs e)
{
sayacValue = 0;
int LoopCount = Convert.ToInt32(textBox_send.Text);
for (int s = 0; s < LoopCount; s++)
{
OpenValf();
IncreaseValfValue();
System.Threading.Thread.Sleep(400);
CloseValf();
System.Threading.Thread.Sleep(400);
}
}
public int IncreaseValfValue() //Counter Control Function
{
sayacValue++;
sayac.Text = sayacValue.ToString();
return sayacValue;
}
How can I do it using Thread or any other method?