Here's the situation: I have 3 webforms in my project. Form 1 allows
the user to select a type of report to generate. There are 2 possible
type of reports, and therefore, Forms 2 and 3 are these two generated
reports. When being generated, both reports will need to use the exact
same data. The data are static strings and I plan to declare a global
array in Form 1, so that Form 2 and 3 can share them. In other words, I
don't want to be declaring identical arrays in both Form 2 and 3 because
that's just gonna waste space and make the code more messy. So the idea
is simple, but I, having problems creating/declaring a global array in
Form 1. Here's my approach:
//Form1.cs
namespace Report
{
public class Form1
{
internal string[] array = new string[] { "one", "two", "three"};
}
}
//Form2.cs
namespace Report
{
public class Form2
{
textBox.Text = array[0];
}
}
//Form3.cs
namespace Report
{
public class Form3
{
textBox.Text = array[1];
}
}
I got errors when compiling which says that "the type or namespace
'array' could not be found (are you missing a using directive or an
assembly reference?)". Why is it not working? I thought that the
"internal" modifier allows the variable to be accessible throughout the
assembly, so why would I need to include any directives or references?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!