I have Form1 and class in file called AbstractClass.cs.
I want to call a label in Form1 and assign msg string to the text in that lable.
How can I do that???
here is my class.
//"Concrete CPUMoon" drived from AbstractCPU class when Diagnosticing CPU for Moon system
class CPUMoon : AbstractCPU
{
public override void DisplayName(AbstractCPU a)
{
//Form1 f1 = new Form1();
string msg;
// create reader & open file
StreamReader tr = new StreamReader("Moon.txt");
String fromFile = tr.ReadLine();
// close the stream
tr.Close();
msg = "CPU diagnosing has be done for " + a.GetType().Name + " " + fromFile;
//Console.WriteLine("CPU diagnosing has be done for " + a.GetType().Name + " //" + fromFile);
}
}
All You need is a Property in your class and then call this property from the class like