Please excuse my ignorance, I am transitioning from VB6 to C# (very steep learning curve). I have googled this to death and I am not able to figure this out. I instantiated a Class on my main form:
namespace App1_Name
{
public partial class Form1 : Form
{
public cConfig Config = new cConfig();
}
}
In my Config Class I am instantiating two other classes:
namespace App1_Name
{
class cConfig
{
//Properties
public cApplication Application = new cApplication();
}
}
In my cApplications Class I have the following:
namespace App1_Name
{
class cApplication
{
//Properties
public string ApplicationName { get { return "App Name"; } }
}
}
So in another class I am looking to use the class I instantiated on Form1 as so:
namespace App1_Name
{
class cXML
{
public void Method1()
{
Console.WriteLine(Config.Application.ApplicationName);)
}
}
}
But I am getting an error that states “Config” doesn’t exist in the current context, what am I doing wrong here?
Don’t you miss instance of Form1?
because you are working with properties… not static classes and static methods.