Hi., I should use 2 class like, ClassA and ClassB and each class have one label to print result.
I created a variable in ClassA , and created a method like below.
Protected void Display()
{
for (Val = 1; Val <= 10; Val++)
{
lblMain.Text = "The Current Value in ClassA: " + Val;
Thread.Sleep(2000);
ClassB objClassB = new ClassB();
lblSub.Text = "The Current Value in ClassB: " + objClassB.PrintValue(Val);
}
}
I have created a method called PrintValue() in ClassB
public string PrintValue(int pVal)
{
return pVal.ToString();
}
Finally It displays last value of for loop outcome value.
But i should display the Value like, 1 in lblMain.Text after 2 seconds 1 in lblSub.Text like wise it should change the value and print.
We should view the changing value using thread.
How to do that in c#?