I looked on another question similar to this but couldn't quite understand what they did to solve the problem.
I am simply passing a value into a public static int:
namespace ModNote
{
public partial class homeScreen : Form
{
public homeScreen()
{
InitializeComponent();
}
private void gamemodButton_Click(object sender, EventArgs e)
{
backgroundProgram.moduleNumber = 1;
this.Hide();
moduleScreen showForm = new moduleScreen();
showForm.Show();
}
and this is where this variable is initialized
namespace ModNote
{
#region // Setting up Variables
public class backgroundProgram
{
public static int moduleNumber;
}
#endregion
}
and here a picture of the error: http://puu.sh/opETJ/fb8152d164.png
Thankyou.
edit: initializing the string array causes this error, any problems with this array being initialized? (moduleArray)
namespace ModNote
{
#region // Setting up Variables
public class backgroundProgram
{
public static int moduleNumber;
public static string[] noteArray;
public static string[] moduleArray = new string[7]
{ File.ReadAllText(@"ModulesFile\CGP1005M.txt"),
File.ReadAllText(@"ModulesFile\CMP1005M.txt"),
File.ReadAllText(@"ModulesFile\CMP1123M.txt"),
File.ReadAllText(@"ModulesFile\CMP1124M.txt"),
File.ReadAllText(@"ModulesFile\CMP1125M.txt"),
File.ReadAllText(@"ModulesFile\CMP1127M.txt"),
File.ReadAllText(@"ModulesFile\CMP1129M.txt")
};
}
#endregion
}