Hi,
I've got two different forms in my WinForms app (MainForm and Form2 say). They both ask for an access of MyDataSet, via a "getInstance" static method. The issue is after MainForm has got an instance, when Form2 needs to get an instance the static "myDataSet" variable is null, whereas I expect to have been already set? Any ideas?
public class MyDataSet
{
public static MyDataSet myDataSet;
// This was null 2nd call to getInstance
private DataSet myData = new DataSet();
public static MyDataSet GetInstance()
{
if (myDataSet == null)
{
return new MyDataSet();
}
else
{
return myDataSet;
}
}
So it almost seems the static "myDataSet" variable isn't working in terms of only having once instance?