Variable scope problem
Posted on 2005-04-29
I want to pass a variable from Form1 to Form2, and the variable is a two-dimensional array of type string[,].
Now, in Form2 I have code:
public frmResults(string[,] DiseaseArray)
string[,] currDiseaseArray = DiseaseArray;
lblOne.Caption = currDiseaseArray[0,0];
and later on it says:
static void Main()
There is something wrong with this second part, I get error CS0103 saying "The name 'DiseaseArray' does not exist in the class or namespace 'CZ_demo_hoofdpijn.frmResults'".
I don't know how to solve this. If I leave DiseaseArray away, I get an understandable error that this method overloading does not take 0 arguments.
I guess it has something to do with the scope, the Main() does just not know about my array. But how do I solve this?