I have a problem in C# that I have faced a few times before, but I have always managed to work around it. Basically, I need to, from one class, access another class that has not been created in the current class. Both classes are in the same namespace.
Example:
Code:
//Form1.cs
ClassTwo testClass;
public void Initialize()
{
testClass = new ClassTwo();
testClass.doTest();
}
public void aTest(string text)
{
this.Text=text;
}
//End of Form1.cs
//ClassTwo.cs
public void doTest()
{
Form1.aTest("This is a test");
}
//End of ClassTwo.cs
This is basically what I want to do. But it won't allow me to access the method(s) in Form1. How can I do this without creating a second instance of Form1?